summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts/library
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-04-12 17:07:01 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-04-12 17:07:01 -0400
commit7967d127716de50f63dca9bd137f43ab642770bf (patch)
treef8d4826c58fff02dd7e1e24bccbee2ba79ab4a54 /roles/openshift_facts/library
parentdf44d99957b9d44bf9d221b224a46865c3224d2c (diff)
parent0879620498b1251f3a375b9a5657c16dd571906a (diff)
downloadopenshift-7967d127716de50f63dca9bd137f43ab642770bf.tar.gz
openshift-7967d127716de50f63dca9bd137f43ab642770bf.tar.bz2
openshift-7967d127716de50f63dca9bd137f43ab642770bf.tar.xz
openshift-7967d127716de50f63dca9bd137f43ab642770bf.zip
Merge pull request #1718 from brenton/docker1
Containerized installs on RHEL were downgrading docker unnecessarily
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 92d650550..2b68f27b7 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1080,13 +1080,9 @@ def get_openshift_version(facts, cli_image=None):
elif 'node' in facts:
container = facts['common']['service_type'] + '-node'
- if container is not None:
- exit_code, output, _ = module.run_command(['docker', 'exec', container, 'openshift', 'version'])
- # if for some reason the container is installed but not running
- # we'll fall back to using docker run later in this method.
- if exit_code == 0:
- version = parse_openshift_version(output)
-
+ # Try to get the version fromthe available cli image _before_ resorting
+ # to exec'ing in to the running container. This is to be more fault
+ # tolerant in environments where the container is not running.
if version is None and cli_image is not None:
# Assume we haven't installed the environment yet and we need
# to query the latest image, but only if docker is installed
@@ -1094,6 +1090,13 @@ def get_openshift_version(facts, cli_image=None):
exit_code, output, _ = module.run_command(['docker', 'run', '--rm', cli_image, 'version'])
version = parse_openshift_version(output)
+ if version is None and container is not None:
+ exit_code, output, _ = module.run_command(['docker', 'exec', container, 'openshift', 'version'])
+ # if for some reason the container is installed but not running
+ # we'll fall back to using docker run later in this method.
+ if exit_code == 0:
+ version = parse_openshift_version(output)
+
return version
def parse_openshift_version(output):
@@ -1351,7 +1354,7 @@ def set_container_facts_if_unset(facts):
facts['common']['admin_binary'] = '/usr/local/bin/oadm'
facts['common']['client_binary'] = '/usr/local/bin/oc'
openshift_version = get_openshift_version(facts, cli_image)
- if openshift_version is not None:
+ if openshift_version is not None and openshift_version is not "":
base_version = openshift_version.split('-')[0]
facts['common']['image_tag'] = "v" + base_version