summaryrefslogtreecommitdiffstats
path: root/roles/openshift_version/tasks
diff options
context:
space:
mode:
authorJan Chaloupka <jchaloup@redhat.com>2017-05-12 12:27:15 +0200
committerGitHub <noreply@github.com>2017-05-12 12:27:15 +0200
commit57185bdd2415d4bbdeb6d18dfdaea65d0c440ae1 (patch)
treee6124d2c61c8284f0047da09f0bd3e461e0220f7 /roles/openshift_version/tasks
parent52c19f7eeffe9dc8b480f6645564be5f1dffe677 (diff)
parent13b58846f6c595c9530fe49e3a00ed6f3f42a896 (diff)
downloadopenshift-57185bdd2415d4bbdeb6d18dfdaea65d0c440ae1.tar.gz
openshift-57185bdd2415d4bbdeb6d18dfdaea65d0c440ae1.tar.bz2
openshift-57185bdd2415d4bbdeb6d18dfdaea65d0c440ae1.tar.xz
openshift-57185bdd2415d4bbdeb6d18dfdaea65d0c440ae1.zip
Merge pull request #4065 from ingvagabund/introduce-get-rpm-version-role
Introduce excluder-free rpm version detection role
Diffstat (limited to 'roles/openshift_version/tasks')
-rw-r--r--roles/openshift_version/tasks/main.yml12
-rw-r--r--roles/openshift_version/tasks/rpm_version.yml44
-rw-r--r--roles/openshift_version/tasks/set_version_rpm.yml16
3 files changed, 23 insertions, 49 deletions
diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml
index d8b1158a6..2e9b4cad3 100644
--- a/roles/openshift_version/tasks/main.yml
+++ b/roles/openshift_version/tasks/main.yml
@@ -89,8 +89,16 @@
- block:
- name: Set openshift_version for containerized installation
include: set_version_containerized.yml
- - name: Determine openshift rpm version
- include: rpm_version.yml
+ - name: Get available {{ openshift.common.service_type}} version
+ repoquery:
+ name: "{{ openshift.common.service_type}}"
+ ignore_excluders: true
+ register: rpm_results
+ - fail:
+ msg: "Package {{ openshift.common.service_type}} not found"
+ when: not rpm_results.results.package_found
+ - set_fact:
+ openshift_rpm_version: "{{ rpm_results.results.versions.available_versions.0 | default('0.0', True) }}"
- name: Fail if rpm version and docker image version are different
fail:
msg: "OCP rpm version {{ openshift_rpm_version }} is different from OCP image version {{ openshift_version }}"
diff --git a/roles/openshift_version/tasks/rpm_version.yml b/roles/openshift_version/tasks/rpm_version.yml
deleted file mode 100644
index bd5e94b43..000000000
--- a/roles/openshift_version/tasks/rpm_version.yml
+++ /dev/null
@@ -1,44 +0,0 @@
----
-# input_variables:
-# - repoquery_cmd
-# - openshift.common.service_type
-# output_variables:
-# - openshift_rpm_version
-
-# 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 }}"
- remote_src: True
-
-- 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 }} --config "{{ yum_conf_temp_file }}" --qf '%{version}' "{{ openshift.common.service_type}}"
- register: common_version
- failed_when: false
- changed_when: false
-
-- name: Delete the temporary yum.conf
- file:
- path: "{{ yum_conf_temp_file_result.stdout }}"
- state: absent
-
-- set_fact:
- openshift_rpm_version: "{{ common_version.stdout | default('0.0', True) }}"
diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml
index 3cf78068b..c40777bf1 100644
--- a/roles/openshift_version/tasks/set_version_rpm.yml
+++ b/roles/openshift_version/tasks/set_version_rpm.yml
@@ -8,7 +8,17 @@
- openshift_version is not defined
- block:
- - include: rpm_version.yml
+ - name: Get available {{ openshift.common.service_type}} version
+ repoquery:
+ name: "{{ openshift.common.service_type}}"
+ ignore_excluders: true
+ register: rpm_results
+
+ - fail:
+ msg: "Package {{ openshift.common.service_type}} not found"
+ when: not rpm_results.results.package_found
+
- set_fact:
- openshift_version: "{{ openshift_rpm_version }}"
- when: openshift_version is not defined
+ openshift_version: "{{ rpm_results.results.versions.available_versions.0 | default('0.0', True) }}"
+ when:
+ - openshift_version is not defined