diff options
-rwxr-xr-x | roles/openshift_health_checker/library/aos_version.py | 18 | ||||
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/package_version.py | 13 |
2 files changed, 17 insertions, 14 deletions
diff --git a/roles/openshift_health_checker/library/aos_version.py b/roles/openshift_health_checker/library/aos_version.py index 37c8b483c..13b7d310b 100755 --- a/roles/openshift_health_checker/library/aos_version.py +++ b/roles/openshift_health_checker/library/aos_version.py @@ -14,10 +14,11 @@ import yum # pylint: disable=import-error from ansible.module_utils.basic import AnsibleModule -def main(): # pylint: disable=missing-docstring +def main(): # pylint: disable=missing-docstring,too-many-branches module = AnsibleModule( argument_spec=dict( - version=dict(required=True) + prefix=dict(required=True), # atomic-openshift, origin, ... + version=dict(required=True), ), supports_check_mode=True ) @@ -25,19 +26,24 @@ def main(): # pylint: disable=missing-docstring def bail(error): # pylint: disable=missing-docstring module.fail_json(msg=error) + rpm_prefix = module.params['prefix'] + + if not rpm_prefix: + bail("prefix must not be empty") + yb = yum.YumBase() # pylint: disable=invalid-name # search for package versions available for aos pkgs expected_pkgs = [ - 'atomic-openshift', - 'atomic-openshift-master', - 'atomic-openshift-node', + rpm_prefix, + rpm_prefix + '-master', + rpm_prefix + '-node', ] try: pkgs = yb.pkgSack.returnPackages(patterns=expected_pkgs) except yum.Errors.PackageSackError as e: # pylint: disable=invalid-name # you only hit this if *none* of the packages are available - bail('Unable to find any atomic-openshift packages. \nCheck your subscription and repo settings. \n%s' % e) + bail('Unable to find any OpenShift packages.\nCheck your subscription and repo settings.\n%s' % e) # determine what level of precision we're expecting for the version expected_version = module.params['version'] diff --git a/roles/openshift_health_checker/openshift_checks/package_version.py b/roles/openshift_health_checker/openshift_checks/package_version.py index b31b4d401..7fa09cbfd 100644 --- a/roles/openshift_health_checker/openshift_checks/package_version.py +++ b/roles/openshift_health_checker/openshift_checks/package_version.py @@ -9,15 +9,12 @@ class PackageVersion(NotContainerized, OpenShiftCheck): name = "package_version" tags = ["preflight"] - @classmethod - def is_active(cls, task_vars): - return ( - super(PackageVersion, cls).is_active(task_vars) - and task_vars.get("deployment_type") == "openshift-enterprise" - ) - def run(self, tmp, task_vars): + rpm_prefix = get_var(task_vars, "openshift", "common", "service_type") openshift_release = get_var(task_vars, "openshift_release") - args = {"version": openshift_release} + args = { + "prefix": rpm_prefix, + "version": openshift_release, + } return self.module_executor("aos_version", args, tmp, task_vars) |