summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2016-10-10 09:32:11 -0700
committerTim Bielawa <tbielawa@redhat.com>2016-10-20 07:49:40 -0700
commit62d9ece28e270a2088511b0d37fa85de3b81bcce (patch)
treef48fba96119ec50261ad48ba1760a26fbe0382ea /roles
parent83bdf2827aa2540872518b814b79c4753f66f1f6 (diff)
downloadopenshift-62d9ece28e270a2088511b0d37fa85de3b81bcce.tar.gz
openshift-62d9ece28e270a2088511b0d37fa85de3b81bcce.tar.bz2
openshift-62d9ece28e270a2088511b0d37fa85de3b81bcce.tar.xz
openshift-62d9ece28e270a2088511b0d37fa85de3b81bcce.zip
The JSON result saving template now includes a summary of expired/warned certs for easier parsing.
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_certificate_expiry/templates/save_json_results.j216
1 files changed, 15 insertions, 1 deletions
diff --git a/roles/openshift_certificate_expiry/templates/save_json_results.j2 b/roles/openshift_certificate_expiry/templates/save_json_results.j2
index fe2800548..9b165f26c 100644
--- a/roles/openshift_certificate_expiry/templates/save_json_results.j2
+++ b/roles/openshift_certificate_expiry/templates/save_json_results.j2
@@ -1,6 +1,20 @@
{
+ "data": {
{% for host in play_hosts %}
- "{{host}}": {{ hostvars[host].check_results.check_results | to_nice_json(indent=4) }}{% if not loop.last %},
+{# Pretty print the check results for each host #}
+ "{{host}}": {{ hostvars[host].check_results.check_results | to_nice_json(indent=6) }}{% if not loop.last %},
+{% else %}
+
{% endif %}
{% endfor %}
+ },
+{# extract the nested warning/expired value from the hostvars object
+using items in the playhosts list as a map. Wrap those results up into
+a list and then add them all together #}
+{%- set warned = play_hosts|map('extract', hostvars, ['check_results', 'summary', 'warning'])|list|sum %}
+{%- set expired = play_hosts|map('extract', hostvars, ['check_results', 'summary', 'expired'])|list|sum %}
+ "summary": {
+ "warning": {{ warned }},
+ "expired": {{ expired }}
+ }
}