diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-09-28 17:33:39 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-09-29 12:59:00 -0700 |
commit | b1b4f8480c78663a5807d12e6917a94421d5b0b6 (patch) | |
tree | d6fe26a10808ccfa23f659a8fb1906faacbb4ccd /oslo_middleware/healthcheck/__init__.py | |
parent | 77a6d8aef4429e413aac3723e36337f42d8a53bc (diff) | |
download | oslo-middleware-b1b4f8480c78663a5807d12e6917a94421d5b0b6.tar.gz |
Allow health check results to provide there own details
When in detailed mode, show the provided details in a nicely
formatted table (or json) so that the user of the healthcheck
middleware can gain more insight into the result that was
produced.
Change-Id: I2fc1f7588ee628990d78b15ad337bd0eebbe8fb3
Diffstat (limited to 'oslo_middleware/healthcheck/__init__.py')
-rw-r--r-- | oslo_middleware/healthcheck/__init__.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/oslo_middleware/healthcheck/__init__.py b/oslo_middleware/healthcheck/__init__.py index 9e46bd8..cacc9b6 100644 --- a/oslo_middleware/healthcheck/__init__.py +++ b/oslo_middleware/healthcheck/__init__.py @@ -162,6 +162,23 @@ class Healthcheck(base.ConfigurableMiddleware): <H2>Result of {{results|length}} checks:</H2> <TABLE bgcolor="#ffffff" border="1"> <TBODY> +<TR> +{% if detailed -%} +<TH> +Kind +</TH> +<TH> +Reason +</TH> +<TH> +Details +</TH> +{% else %} +<TH> +Reason +</TH> +{%- endif %} +</TR> {% for result in results -%} {% if result.reason -%} <TR> @@ -169,6 +186,9 @@ class Healthcheck(base.ConfigurableMiddleware): <TD>{{result.class|e}}</TD> {%- endif %} <TD>{{result.reason|e}}</TD> +{% if detailed -%} + <TD>{{result.details|e}}</TD> +{%- endif %} </TR> {%- endif %} {%- endfor %} @@ -293,6 +313,7 @@ class Healthcheck(base.ConfigurableMiddleware): for result in results: reasons.append({ 'reason': result.reason, + 'details': result.details or '', 'class': reflection.get_class_name(result, fully_qualified=False), }) @@ -317,6 +338,7 @@ class Healthcheck(base.ConfigurableMiddleware): translated_results = [] for result in results: translated_results.append({ + 'details': result.details or '', 'reason': result.reason, 'class': reflection.get_class_name(result, fully_qualified=False), |