Commit c89c31a5 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

cli: Allow to run --preapre-only w/o additional information

/reviewed-on !4
parent acf0f054
......@@ -146,21 +146,20 @@ def updater(*args):
'state',
type=str,
help='Path to JSON state file for fallback recognition, on which locks '
'will happen.'
'will happen.',
nargs='?'
)
parser.add_argument(
'--identity',
type=argparse.FileType('r'),
help='Certificate to identify itself on the URL.',
required=True
)
parser.add_argument(
'--server-ca-certificate',
type=argparse.FileType('r'),
help='CA Certificate of the server.',
required=True
)
parser.add_argument(
......@@ -200,10 +199,12 @@ def updater(*args):
u = Updater(
parsed.sleep, parsed.mapping.name, parsed.state, parsed.master_certificate,
parsed.on_update, parsed.identity.name, parsed.server_ca_certificate.name,
parsed.on_update,
parsed.identity and parsed.identity.name or None,
parsed.server_ca_certificate and parsed.server_ca_certificate.name or None,
parsed.once, parsed.prepare_only
)
parsed.mapping.close()
parsed.identity.close()
parsed.server_ca_certificate.close()
parsed.identity and parsed.identity.close()
parsed.server_ca_certificate and parsed.server_ca_certificate.close()
u.loop()
......@@ -1339,6 +1339,16 @@ class KedifaUpdaterUpdateCertificateTest(
self.assertTrue(update)
self.assertState({self.certificate_file_name: True})
class KedifaUpdaterUpdateCertificatePrepareTest(
KedifaUpdaterMixin, unittest.TestCase):
def setUp(self):
super(KedifaUpdaterUpdateCertificatePrepareTest, self).setUp()
certificate_file = tempfile.NamedTemporaryFile(
dir=self.testdir, delete=True)
certificate_file.close()
self.certificate_file_name = certificate_file.name
def _prepare(self, certificate, master_content, fallback=None):
if certificate:
with open(self.certificate_file_name, 'w') as fh:
......@@ -1362,7 +1372,7 @@ class KedifaUpdaterUpdateCertificateTest(
mapping = '%s %s' % (mapping, fallback_file.name)
self.setupMapping(mapping)
u = updater.Updater(
1, self.mapping, self.state, master_file, None, None,
1, self.mapping, None, master_file, None, None,
None, True, True)
with mock.patch.object(
updater.Updater, 'fetchCertificate') as fetchCertificate:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment