From f502b09c103b5d8681854b7ab6a3c9655311f73b Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Mon, 6 Feb 2017 17:06:18 +0100 Subject: Refactor code to access values from task_vars --- roles/openshift_health_checker/openshift_checks/package_version.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'roles/openshift_health_checker/openshift_checks/package_version.py') diff --git a/roles/openshift_health_checker/openshift_checks/package_version.py b/roles/openshift_health_checker/openshift_checks/package_version.py index 9394466f2..b31b4d401 100644 --- a/roles/openshift_health_checker/openshift_checks/package_version.py +++ b/roles/openshift_health_checker/openshift_checks/package_version.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 @@ -17,10 +17,7 @@ class PackageVersion(NotContainerized, OpenShiftCheck): ) def run(self, tmp, task_vars): - try: - openshift_release = task_vars["openshift_release"] - except (KeyError, TypeError): - raise OpenShiftCheckException("'openshift_release' is undefined") + openshift_release = get_var(task_vars, "openshift_release") args = {"version": openshift_release} return self.module_executor("aos_version", args, tmp, task_vars) -- cgit v1.2.3