Commit b9261dc1 authored by Adrien Dorsaz's avatar Adrien Dorsaz

reduce a bit more number of lines

parent 5e624d00
......@@ -244,12 +244,10 @@ def get_crt(config, log=LOGGER):
# get the parent certificate which had created this one
certificate_parent_url = _get_url_link(headers, 'up')
resp = urlopen(certificate_parent_url)
code = resp.getcode()
result =
if code not in [200, 201]:
if resp.getcode() not in [200, 201]:
raise ValueError("Error getting certificate chain from {0}: {1} {2}".format(
certificate_parent_url, code, result))
certificate_parent = "\n".join(textwrap.wrap(base64.b64encode(result).decode("utf8"), 64))
certificate_parent_url, code,
certificate_parent = "\n".join(textwrap.wrap(base64.b64encode("utf8"), 64))"Certificate signed and received.")
return """-----BEGIN CERTIFICATE-----\n{0}\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n{1}\n-----END CERTIFICATE-----\n""".format(
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