diff options
author | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-02-06 17:06:18 +0100 |
---|---|---|
committer | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-02-10 19:49:01 +0100 |
commit | f502b09c103b5d8681854b7ab6a3c9655311f73b (patch) | |
tree | 92a10933acc42815ed14f9516b41d4028ed771d6 /roles/openshift_health_checker/openshift_checks/package_availability.py | |
parent | d6cebd0f5c43762469b1218e1e4e4bdb608cda19 (diff) | |
download | openshift-f502b09c103b5d8681854b7ab6a3c9655311f73b.tar.gz openshift-f502b09c103b5d8681854b7ab6a3c9655311f73b.tar.bz2 openshift-f502b09c103b5d8681854b7ab6a3c9655311f73b.tar.xz openshift-f502b09c103b5d8681854b7ab6a3c9655311f73b.zip |
Refactor code to access values from task_vars
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks/package_availability.py')
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/package_availability.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/package_availability.py b/roles/openshift_health_checker/openshift_checks/package_availability.py index 31277a3b9..8faeef5ee 100644 --- a/roles/openshift_health_checker/openshift_checks/package_availability.py +++ b/roles/openshift_health_checker/openshift_checks/package_availability.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring -from openshift_checks import OpenShiftCheck, OpenShiftCheckException +from openshift_checks import OpenShiftCheck, get_var from openshift_checks.mixins import NotContainerized @@ -10,12 +10,8 @@ class PackageAvailability(NotContainerized, OpenShiftCheck): tags = ["preflight"] def run(self, tmp, task_vars): - try: - rpm_prefix = task_vars["openshift"]["common"]["service_type"] - except (KeyError, TypeError): - raise OpenShiftCheckException("'openshift.common.service_type' is undefined") - - group_names = task_vars.get("group_names", []) + rpm_prefix = get_var(task_vars, "openshift", "common", "service_type") + group_names = get_var(task_vars, "group_names", default=[]) packages = set() |