summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts/library
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-06-17 09:10:20 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-06-17 09:10:20 -0300
commit63ea5cce369710363dd09b2b64c40871c6ce55f9 (patch)
tree5c8da7955701bf97351f07d8bed73c34659f8ef8 /roles/openshift_facts/library
parentb4d702c0115cb97f118e1fdc77f6326eda923a47 (diff)
downloadopenshift-63ea5cce369710363dd09b2b64c40871c6ce55f9.tar.gz
openshift-63ea5cce369710363dd09b2b64c40871c6ce55f9.tar.bz2
openshift-63ea5cce369710363dd09b2b64c40871c6ce55f9.tar.xz
openshift-63ea5cce369710363dd09b2b64c40871c6ce55f9.zip
More stable lookup of running openshift version.
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 6c31f0fa8..62d478bfc 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1139,7 +1139,7 @@ def get_openshift_version(facts):
# these control the running versions when containerized, and would work even if the service
# is dead for some reason.
elif 'common' in facts and 'is_containerized' in facts['common']:
- version = get_containerized_node_openshift_version(facts)
+ version = get_containerized_openshift_version(facts)
# Handle containerized masters that have not yet been configured as a node.
# This can be very slow and may get re-run multiple times, so we only use this
@@ -1151,20 +1151,21 @@ def get_openshift_version(facts):
return version
-def get_containerized_node_openshift_version(facts):
+def get_containerized_openshift_version(facts):
# If containerized, see if we can determine the installed version via the systemd environment files:
- node_env = '/etc/sysconfig/%s-node' % facts['common']['service_type']
- if not os.path.exists(node_env):
- return None
-
- with open(node_env) as f:
- for line in f:
- if line.startswith("IMAGE_VERSION="):
- tag = line[len("IMAGE_VERSION="):]
- # Remove leading "v" and any trailing release info, we just want
- # a version number here:
- version = tag[1:].split("-")[0]
- return version
+ for filename in ['/etc/sysconfig/%s-master', '/etc/sysconfig/%s-node']:
+ env_file = filename % facts['common']['service_type']
+ if not os.path.exists(env_file):
+ continue
+
+ with open(env_file) as f:
+ for line in f:
+ if line.startswith("IMAGE_VERSION="):
+ tag = line[len("IMAGE_VERSION="):]
+ # Remove leading "v" and any trailing release info, we just want
+ # a version number here:
+ version = tag[1:].split("-")[0]
+ return version
return None