summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-02-09 08:42:13 -0500
committerBrenton Leanhardt <bleanhar@redhat.com>2016-02-09 08:42:13 -0500
commita13d9b9ae01ab73c85d1ebcf98167cf70e85b974 (patch)
treed6bd28ab0ebbfcfffc935763fa0aa940fbff6f61 /roles/openshift_facts
parenta87dfdd698f251d3892ef98f189b9f08539039f5 (diff)
parent79dbcc69c8574ffbe3dc5c6fb98129e365cf63cb (diff)
downloadopenshift-a13d9b9ae01ab73c85d1ebcf98167cf70e85b974.tar.gz
openshift-a13d9b9ae01ab73c85d1ebcf98167cf70e85b974.tar.bz2
openshift-a13d9b9ae01ab73c85d1ebcf98167cf70e85b974.tar.xz
openshift-a13d9b9ae01ab73c85d1ebcf98167cf70e85b974.zip
Merge pull request #1334 from brenton/bz1304150
Bug 1304150 - Can't upgrade atomic-openshift to specified version
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 85c8abdf0..d11af307b 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1070,6 +1070,28 @@ def set_container_facts_if_unset(facts):
return facts
+def set_installed_variant_rpm_facts(facts):
+ """ Set RPM facts of installed variant
+ Args:
+ facts (dict): existing facts
+ Returns:
+ dict: the facts dict updated with installed_variant_rpms
+ """
+ installed_rpms = []
+ for base_rpm in ['openshift', 'atomic-openshift', 'origin']:
+ optional_rpms = ['master', 'node', 'clients', 'sdn-ovs']
+ variant_rpms = [base_rpm] + \
+ ['{0}-{1}'.format(base_rpm, r) for r in optional_rpms] + \
+ ['tuned-profiles-%s-node' % base_rpm]
+ for rpm in variant_rpms:
+ exit_code, _, _ = module.run_command(['rpm', '-q', rpm])
+ if exit_code == 0:
+ installed_rpms.append(rpm)
+
+ facts['common']['installed_variant_rpms'] = installed_rpms
+ return facts
+
+
class OpenShiftFactsInternalError(Exception):
"""Origin Facts Error"""
@@ -1159,6 +1181,8 @@ class OpenShiftFacts(object):
facts = set_aggregate_facts(facts)
facts = set_etcd_facts_if_unset(facts)
facts = set_container_facts_if_unset(facts)
+ if not facts['common']['is_containerized']:
+ facts = set_installed_variant_rpm_facts(facts)
return dict(openshift=facts)
def get_defaults(self, roles):