Commit c5634e69 authored by Vincent Pelletier's avatar Vincent Pelletier

cli.updater: Make testable.

parent 1fec835c
......@@ -589,7 +589,7 @@ def probe(argv=None):
if https_ca_pem not in (http_ca_pem, http2_ca_pem):
raise ValueError('http and https do not serve the same caucase database')
def updater(argv=None):
def updater(argv=None, until=utils.until):
"""
Bootstrap certificate and companion files and keep them up-to-date.
"""
......@@ -719,7 +719,7 @@ def updater(argv=None):
# through.
client.getCertificateSigningRequest(csr_id)
# Still here ? Ok, wait a bit and try again.
utils.interruptibleSleep(60)
until(datetime.datetime.utcnow() + datetime.timedelta(0, 60))
else:
with open(args.crt, 'a') as crt_file:
crt_file.write(crt_pem)
......@@ -731,7 +731,7 @@ def updater(argv=None):
print 'Next wake-up at', next_deadline.strftime(
'%Y-%m-%d %H:%M:%S +0000'
)
now = utils.until(next_deadline)
now = until(next_deadline)
if args.cas_ca != args.ca and updateCAFile(cas_url, args.cas_ca):
client = CaucaseClient(
ca_url=ca_url,
......
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