diff options
author | Jason DeTiberus <jdetiber@redhat.com> | 2016-12-20 14:54:43 -0500 |
---|---|---|
committer | Jason DeTiberus <jdetiber@redhat.com> | 2016-12-20 16:05:49 -0500 |
commit | 4cdc771f8e04f88ac47dd194da03dadfa2fdba2d (patch) | |
tree | 3e394b3da742faaa0d5d97dd0a74d4efd03c6567 /roles/openshift_certificate_expiry | |
parent | 3e5f3380ccacc654450924fca830b93fda6c7592 (diff) | |
download | openshift-4cdc771f8e04f88ac47dd194da03dadfa2fdba2d.tar.gz openshift-4cdc771f8e04f88ac47dd194da03dadfa2fdba2d.tar.bz2 openshift-4cdc771f8e04f88ac47dd194da03dadfa2fdba2d.tar.xz openshift-4cdc771f8e04f88ac47dd194da03dadfa2fdba2d.zip |
python3 support, add tox for better local testing against multiple python versions
Diffstat (limited to 'roles/openshift_certificate_expiry')
-rw-r--r-- | roles/openshift_certificate_expiry/library/openshift_cert_expiry.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py b/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py index 1fac284f2..7161b5277 100644 --- a/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py +++ b/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py @@ -371,7 +371,7 @@ an OpenShift Container Platform cluster ###################################################################### # Load the certificate and the CA, parse their expiration dates into # datetime objects so we can manipulate them later - for _, v in cert_meta.iteritems(): + for _, v in cert_meta.items(): with open(v, 'r') as fp: cert = fp.read() cert_subject, cert_expiry_date, time_remaining = load_and_handle_cert(cert, now) @@ -654,9 +654,13 @@ an OpenShift Container Platform cluster # will be at the front of the list and certificates which will # expire later are at the end. Router and registry certs should be # limited to just 1 result, so don't bother sorting those. - check_results['ocp_certs'] = sorted(check_results['ocp_certs'], cmp=lambda x, y: cmp(x['days_remaining'], y['days_remaining'])) - check_results['kubeconfigs'] = sorted(check_results['kubeconfigs'], cmp=lambda x, y: cmp(x['days_remaining'], y['days_remaining'])) - check_results['etcd'] = sorted(check_results['etcd'], cmp=lambda x, y: cmp(x['days_remaining'], y['days_remaining'])) + def cert_key(item): + ''' return the days_remaining key ''' + return item['days_remaining'] + + check_results['ocp_certs'] = sorted(check_results['ocp_certs'], key=cert_key) + check_results['kubeconfigs'] = sorted(check_results['kubeconfigs'], key=cert_key) + check_results['etcd'] = sorted(check_results['etcd'], key=cert_key) # This module will never change anything, but we might want to # change the return code parameter if there is some catastrophic |