diff options
author | Luke Meyer <lmeyer@redhat.com> | 2017-07-20 23:39:47 -0400 |
---|---|---|
committer | Luke Meyer <lmeyer@redhat.com> | 2017-08-02 15:03:50 -0400 |
commit | 06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2 (patch) | |
tree | 4631e75c28017e238ff84756f6cfdeb72563259a /roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py | |
parent | bf0828bc0f2e3088df20abc77e30a162595e1c22 (diff) | |
download | openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.tar.gz openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.tar.bz2 openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.tar.xz openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.zip |
openshift_checks: refactor logging checks
Turn failure messages into exceptions that tests can look for without
depending on text meant for humans.
Turn logging_namespace property into a method.
Get rid of _exec_oc and just use logging.exec_oc.
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py')
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py b/roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py index 0970f0a63..d783e6760 100644 --- a/roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py +++ b/roles/openshift_health_checker/openshift_checks/logging/fluentd_config.py @@ -24,7 +24,6 @@ class FluentdConfig(LoggingCheck): def run(self): """Check that Fluentd has running pods, and that its logging config matches Docker's logging config.""" - self.logging_namespace = self.get_var("openshift_logging_namespace", default=self.logging_namespace) config_error = self.check_logging_config() if config_error: msg = ("The following Fluentd logging configuration problem was found:" @@ -120,19 +119,13 @@ class FluentdConfig(LoggingCheck): def running_fluentd_pods(self): """Return a list of running fluentd pods.""" - fluentd_pods, error = self.get_pods_for_component( - self.logging_namespace, - "fluentd", - ) - if error: - msg = 'Unable to retrieve any pods for the "fluentd" logging component: {}'.format(error) - raise OpenShiftCheckException(msg) + fluentd_pods = self.get_pods_for_component("fluentd") running_fluentd_pods = [pod for pod in fluentd_pods if pod['status']['phase'] == 'Running'] if not running_fluentd_pods: - msg = ('No Fluentd pods were found to be in the "Running" state. ' - 'At least one Fluentd pod is required in order to perform this check.') - - raise OpenShiftCheckException(msg) + raise OpenShiftCheckException( + 'No Fluentd pods were found to be in the "Running" state. ' + 'At least one Fluentd pod is required in order to perform this check.' + ) return running_fluentd_pods |