Skip to content

Commit

Permalink
Use openshift_cli_image to find version in openshift_facts when conta…
Browse files Browse the repository at this point in the history
…inerized.
  • Loading branch information
patrickdillon committed Oct 15, 2018
1 parent cf68565 commit 4884219
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions playbooks/init/cluster_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
https_proxy: "{{ openshift_https_proxy | default(None) }}"
no_proxy: "{{ openshift_no_proxy | default(None) }}"
generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}"
openshift_cli_image: "{{ openshift_cli_image }}"

- name: Set fact of no_proxy_internal_hostnames
openshift_facts:
Expand Down
10 changes: 7 additions & 3 deletions roles/openshift_facts/library/openshift_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,6 @@ def get_openshift_version(facts):
version: the current openshift version
"""
version = None
image_type_dict = {'origin': 'openshift/origin',
'openshift-enterprise': 'openshift3/ose'}

# No need to run this method repeatedly on a system if we already know the
# version
Expand All @@ -866,7 +864,13 @@ def get_openshift_version(facts):
image_tag = get_container_openshift_version(deployment_type)
if image_tag is None:
return version
cli_image = image_type_dict[deployment_type] + ":" + image_tag

try:
openshift_cli_image = facts['common']['openshift_cli_image']
except KeyError:
return version

cli_image = openshift_cli_image + ":" + image_tag
_, output, _ = module.run_command(['docker', 'run', '--rm', cli_image, 'version']) # noqa: F405
version = parse_openshift_version(output)

Expand Down

0 comments on commit 4884219

Please sign in to comment.