Skip to content

Commit

Permalink
Merge pull request #10413 from patrickdillon/release-3.9
Browse files Browse the repository at this point in the history
[release-3.9] Fix version issue in openshift_facts when using custom image.
  • Loading branch information
sdodson committed Oct 17, 2018
2 parents 89a65c0 + 584927d commit 6742c77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
1 change: 1 addition & 0 deletions playbooks/init/cluster_facts.yml
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
24 changes: 6 additions & 18 deletions roles/openshift_facts/library/openshift_facts.py
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,12 @@ 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

openshift_cli_image = facts['common'].get('openshift_cli_image')
if not openshift_cli_image:
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 Expand Up @@ -1244,20 +1247,6 @@ def set_buildoverrides_facts(facts):
return facts


# pylint: disable=too-many-statements
def set_container_facts_if_unset(facts):
""" Set containerized facts.
Args:
facts (dict): existing facts
Returns:
dict: the facts dict updated with the generated containerization
facts
"""

return facts


def pop_obsolete_local_facts(local_facts):
"""Remove unused keys from local_facts"""
keys_to_remove = {
Expand Down Expand Up @@ -1379,7 +1368,6 @@ def generate_facts(self,
facts = set_identity_providers_if_unset(facts)
facts = set_deployment_facts_if_unset(facts)
facts = set_sdn_facts_if_unset(facts, self.system_facts)
facts = set_container_facts_if_unset(facts)
facts = build_controller_args(facts)
facts = build_api_server_args(facts)
facts = set_version_facts_if_unset(facts)
Expand Down

0 comments on commit 6742c77

Please sign in to comment.