diff options
author | Tim Bielawa <tbielawa@redhat.com> | 2017-02-21 11:00:00 -0800 |
---|---|---|
committer | Tim Bielawa <tbielawa@redhat.com> | 2017-02-21 11:00:00 -0800 |
commit | 003bc8d5b9233e61c7a2a5f0a27b66ac1babc1a0 (patch) | |
tree | 19d34acf9e16b8221e4a0faaa9cea167723a9025 /roles/openshift_certificate_expiry/library | |
parent | 288e304643a6a02e6d90ed5c1b4e7f6b349ad929 (diff) | |
download | openshift-003bc8d5b9233e61c7a2a5f0a27b66ac1babc1a0.tar.gz openshift-003bc8d5b9233e61c7a2a5f0a27b66ac1babc1a0.tar.bz2 openshift-003bc8d5b9233e61c7a2a5f0a27b66ac1babc1a0.tar.xz openshift-003bc8d5b9233e61c7a2a5f0a27b66ac1babc1a0.zip |
Address cert expiry parsing review comments
Diffstat (limited to 'roles/openshift_certificate_expiry/library')
-rw-r--r-- | roles/openshift_certificate_expiry/library/openshift_cert_expiry.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py b/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py index 33930c0c1..b093d84fe 100644 --- a/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py +++ b/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py @@ -242,6 +242,8 @@ will be returned # pylint: disable=too-many-locals,too-many-branches +# +# TODO: Break this function down into smaller chunks def load_and_handle_cert(cert_string, now, base64decode=False, ans_module=None): """Load a certificate, split off the good parts, and return some useful data @@ -254,8 +256,8 @@ Params: - `ans_module` (AnsibleModule) - The AnsibleModule object for this module (so we can raise errors) Returns: -A 3-tuple of the form: (certificate_common_name, certificate_expiry_date, certificate_time_remaining) - +A tuple of the form: + (cert_subject, cert_expiry_date, time_remaining, cert_serial_number) """ if base64decode: _cert_string = cert_string.decode('base-64') @@ -287,8 +289,9 @@ A 3-tuple of the form: (certificate_common_name, certificate_expiry_date, certif ans_module.fail_json(msg="Error: The 'OpenSSL' python library and CLI command were not found on the target host. Unable to parse any certificates. This host will not be included in generated reports.") else: openssl_decoded = openssl_decoded.communicate()[0] - os.remove(path) cert_loaded = FakeOpenSSLCertificate(openssl_decoded) + finally: + os.remove(path) ###################################################################### # Read all possible names from the cert |