summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-04-11 16:41:48 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-04-12 16:08:54 -0400
commit0879620498b1251f3a375b9a5657c16dd571906a (patch)
treede68246c033f9932975f79a2de74ae1b08eddbfb /roles/openshift_facts
parent5c7b510d2ac016c8bb09463307f9a471cc924a9d (diff)
downloadopenshift-0879620498b1251f3a375b9a5657c16dd571906a.tar.gz
openshift-0879620498b1251f3a375b9a5657c16dd571906a.tar.bz2
openshift-0879620498b1251f3a375b9a5657c16dd571906a.tar.xz
openshift-0879620498b1251f3a375b9a5657c16dd571906a.zip
Bug 1324728 - Ansible should not downgrade docker when installing 3.2 containerized env
Diffstat (limited to 'roles/openshift_facts')
-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