summaryrefslogtreecommitdiffstats
path: root/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-12-21 13:06:27 -0500
committerGitHub <noreply@github.com>2016-12-21 13:06:27 -0500
commit4c20c6b76f295dc83e2ce730238b7753724e7e53 (patch)
tree4e6ff6855c6e5343e97d0864f47cb2088fe364f9 /roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
parent3e5f3380ccacc654450924fca830b93fda6c7592 (diff)
parent7d02b608de839cb57e2071e9d55052957c13aae3 (diff)
downloadopenshift-4c20c6b76f295dc83e2ce730238b7753724e7e53.tar.gz
openshift-4c20c6b76f295dc83e2ce730238b7753724e7e53.tar.bz2
openshift-4c20c6b76f295dc83e2ce730238b7753724e7e53.tar.xz
openshift-4c20c6b76f295dc83e2ce730238b7753724e7e53.zip
Merge pull request #3001 from detiber/python3
python3 support, add tox for better local testing against multiple python versions
Diffstat (limited to 'roles/openshift_certificate_expiry/library/openshift_cert_expiry.py')
-rw-r--r--roles/openshift_certificate_expiry/library/openshift_cert_expiry.py12
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