diff options
author | OpenShift Bot <eparis+openshiftbot@redhat.com> | 2017-03-28 16:24:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 16:24:20 -0500 |
commit | 89f2e49cbe7f61fa8379343552ae9862f926bbfb (patch) | |
tree | 85c274b5b41cbb3a3ff19024c40173abdff94fcc /roles/openshift_version/tasks | |
parent | d77a9a685c3add9ef9c4d659ee47ebf35e145fe4 (diff) | |
parent | 7fcc44c894888fd9ed4a5997fd7f82bfc8daf19e (diff) | |
download | openshift-89f2e49cbe7f61fa8379343552ae9862f926bbfb.tar.gz openshift-89f2e49cbe7f61fa8379343552ae9862f926bbfb.tar.bz2 openshift-89f2e49cbe7f61fa8379343552ae9862f926bbfb.tar.xz openshift-89f2e49cbe7f61fa8379343552ae9862f926bbfb.zip |
Merge pull request #3781 from ingvagabund/make-the-ocp-version-detection-excluder-free
Merged by openshift-bot
Diffstat (limited to 'roles/openshift_version/tasks')
-rw-r--r-- | roles/openshift_version/tasks/set_version_rpm.yml | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index 7fa74e24f..1e7b5909e 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -5,14 +5,41 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined +# if {{ openshift.common.service_type}}-excluder is enabled, +# the repoquery for {{ openshift.common.service_type}} will not work. +# Thus, create a temporary yum,conf file where exclude= is set to an empty list +- name: Create temporary yum.conf file + command: mktemp -d /tmp/yum.conf.XXXXXX + register: yum_conf_temp_file_result + +- set_fact: + yum_conf_temp_file: "{{yum_conf_temp_file_result.stdout}}/yum.conf" + +- name: Copy yum.conf into the temporary file + copy: + src: /etc/yum.conf + dest: "{{ yum_conf_temp_file }}" + +- name: Clear the exclude= list in the temporary yum.conf + lineinfile: + # since ansible 2.3 s/dest/path + dest: "{{ yum_conf_temp_file }}" + regexp: '^exclude=' + line: 'exclude=' + - name: Gather common package version command: > - {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" + {{ repoquery_cmd }} --config "{{ yum_conf_temp_file }}" --qf '%{version}' "{{ openshift.common.service_type}}" register: common_version failed_when: false changed_when: false when: openshift_version is not defined +- name: Delete the temporary yum.conf + file: + path: "{{ yum_conf_temp_file_result.stdout }}" + state: absent + - set_fact: openshift_version: "{{ common_version.stdout | default('0.0', True) }}" when: openshift_version is not defined |