summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_health_checker')
-rw-r--r--roles/openshift_health_checker/library/aos_version.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/roles/openshift_health_checker/library/aos_version.py b/roles/openshift_health_checker/library/aos_version.py
index c8769b511..34d8f71e7 100644
--- a/roles/openshift_health_checker/library/aos_version.py
+++ b/roles/openshift_health_checker/library/aos_version.py
@@ -32,11 +32,14 @@ try:
PKG_MGR = "yum"
except ImportError as err:
YUM_IMPORT_EXCEPTION = err
-try:
- import dnf # pylint: disable=import-error
- PKG_MGR = "dnf"
-except ImportError as err:
- DNF_IMPORT_EXCEPTION = err
+
+# Import and use dnf only if yum is missing
+if YUM_IMPORT_EXCEPTION:
+ try:
+ import dnf # pylint: disable=import-error
+ PKG_MGR = "dnf"
+ except ImportError as err:
+ DNF_IMPORT_EXCEPTION = err
class AosVersionException(Exception):
@@ -127,8 +130,11 @@ def _retrieve_available_packages(expected_pkgs):
dquery = dbase.sack.query()
aquery = dquery.available()
+ iquery = dquery.installed()
- pkgs = list(aquery.filter(name=expected_pkgs))
+ available_pkgs = list(aquery.filter(name=expected_pkgs))
+ installed_pkgs = list(iquery.filter(name=expected_pkgs))
+ pkgs = available_pkgs + installed_pkgs
if not pkgs:
# pkgs list is empty, raise because no expected packages found