summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-06-16 14:27:20 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-06-16 14:27:20 -0300
commit78dd487871796a71c450a1a1daf78b079a3a1090 (patch)
tree1498e29b8971064dafd7f75e01c2ed0273a15264 /roles/openshift_facts
parent42dec74c57fa76e31a588b2a58f913c68825360d (diff)
downloadopenshift-78dd487871796a71c450a1a1daf78b079a3a1090.tar.gz
openshift-78dd487871796a71c450a1a1daf78b079a3a1090.tar.bz2
openshift-78dd487871796a71c450a1a1daf78b079a3a1090.tar.xz
openshift-78dd487871796a71c450a1a1daf78b079a3a1090.zip
Cleanup, fix 3.1 version bug in facts.
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index eb6369f50..a979639f8 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1113,7 +1113,9 @@ def get_docker_version_info():
return result
def get_openshift_version(facts):
- """ Get current version of openshift on the host
+ """ Get current version of openshift on the host.
+
+ Checks a variety of ways ranging from fastest to slowest.
Args:
facts (dict): existing facts
@@ -1139,18 +1141,17 @@ def get_openshift_version(facts):
elif 'common' in facts and 'is_containerized' in facts['common']:
version = get_containerized_node_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
+ # if other methods failed to find a version.
+ if not version and os.path.isfile('/usr/local/bin/openshift'):
+ _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version'])
+ version = parse_openshift_version(output)
+
return version
-def get_containerized_node_openshift_version(facts):
- node_svc = "%s-node" % facts['common']['service_type']
- rc, _, _ = module.run_command(['systemctl', 'is-active', node_svc])
- if rc > 0:
- # Node service not running or doesn't exist:
- return None
- # Node service running, exec in and get the version:
- _, output, _ = module.run_command(['docker', 'exec', '-ti', node_svc, 'openshift', 'version'])
- return parse_openshift_version(output)
+def get_containerized_node_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):
@@ -1167,8 +1168,6 @@ def get_containerized_node_openshift_version(facts):
return None
-
-
def parse_openshift_version(output):
""" Apply provider facts to supplied facts dict