summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/openshift_checks/package_version.py
blob: a473119f3aa5bf54768a29bfc9ec1c0d9c6d1209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# pylint: disable=missing-docstring
from openshift_checks import OpenShiftCheck, OpenShiftCheckException
from openshift_checks.mixins import NotContainerized


class PackageVersion(NotContainerized, OpenShiftCheck):
    """Check that available RPM packages match the required versions."""

    name = "package_version"

    @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):
        try:
            openshift_release = task_vars["openshift_release"]
        except (KeyError, TypeError):
            raise OpenShiftCheckException("'openshift_release' is undefined")

        args = {"version": openshift_release}
        return self.module_executor("aos_version", args, tmp, task_vars)