summaryrefslogtreecommitdiffstats
path: root/roles/openshift_certificate_expiry/library
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2016-10-10 07:46:03 -0700
committerTim Bielawa <tbielawa@redhat.com>2016-10-20 07:49:40 -0700
commit83bdf2827aa2540872518b814b79c4753f66f1f6 (patch)
treecb73c9639df2c8e7357ab9fb4028daaa6aa3154c /roles/openshift_certificate_expiry/library
parent3e8279ace30affb18d7070a47a13b521995960d5 (diff)
downloadopenshift-83bdf2827aa2540872518b814b79c4753f66f1f6.tar.gz
openshift-83bdf2827aa2540872518b814b79c4753f66f1f6.tar.bz2
openshift-83bdf2827aa2540872518b814b79c4753f66f1f6.tar.xz
openshift-83bdf2827aa2540872518b814b79c4753f66f1f6.zip
Clean up lint and other little things (polish++)
* Fix code lint * Prefix role variables with the role name per best practices * Add words to README
Diffstat (limited to 'roles/openshift_certificate_expiry/library')
-rw-r--r--roles/openshift_certificate_expiry/library/openshift_cert_expiry.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py b/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
index 3b934d019..6e27a7ebd 100644
--- a/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
+++ b/roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
@@ -97,7 +97,6 @@ Source: Alex Martelli - http://stackoverflow.com/a/2819788/6490583
######################################################################
-
def filter_paths(path_list):
"""`path_list` - A list of file paths to check. Only files which exist
will be returned
@@ -339,7 +338,7 @@ an OpenShift Container Platform cluster
check_results['meta'] = {}
check_results['meta']['warning_days'] = warning_days
check_results['meta']['checked_at_time'] = str(now)
- check_results['meta']['warn_after_date'] = str(now + expire_window)
+ check_results['meta']['warn_before_date'] = str(now + expire_window)
check_results['meta']['show_all'] = str(module.params['show_all'])
# All the analyzed certs accumulate here
ocp_certs = []
@@ -551,8 +550,6 @@ an OpenShift Container Platform cluster
######################################################################
# Now for registry
- # registry_secrets = subprocess.call('oc get secret registry-certificates -o yaml'.split())
- # out = subprocess.PIPE
try:
registry_secrets_raw = subprocess.Popen('oc get secret registry-certificates -o yaml'.split(),
stdout=subprocess.PIPE)
@@ -607,11 +604,11 @@ an OpenShift Container Platform cluster
check_results['registry'] = registry_certs
check_results['router'] = router_certs
-
# Sort the final results to report in order of ascending safety
# time. That is to say, the certificates which will expire sooner
# will be at the front of the list and certificates which will
- # expire later are at the end.
+ # 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']))