summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorJan Chaloupka <jchaloup@redhat.com>2017-05-10 15:12:28 +0200
committerGitHub <noreply@github.com>2017-05-10 15:12:28 +0200
commit87c282b612ee53441e7564f53ac49a1a6624d820 (patch)
tree2f1fa15f1d35f461eeac7e7e007a6dfb3b8f0e65 /roles
parent574724e544eb92dafdc24e96e15564f7d143b35e (diff)
parent7563ac56340015ce62e49b9cdbda063ed6721857 (diff)
downloadopenshift-87c282b612ee53441e7564f53ac49a1a6624d820.tar.gz
openshift-87c282b612ee53441e7564f53ac49a1a6624d820.tar.bz2
openshift-87c282b612ee53441e7564f53ac49a1a6624d820.tar.xz
openshift-87c282b612ee53441e7564f53ac49a1a6624d820.zip
Merge pull request #4033 from ingvagabund/report-docker-image-version-and-excluder-rpm-version
[RFE] report and fail if rpm version differs from docker image version
Diffstat (limited to 'roles')
-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.yml42
3 files changed, 58 insertions, 40 deletions
diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml
index fa9b20e92..d8b1158a6 100644
--- a/roles/openshift_version/tasks/main.yml
+++ b/roles/openshift_version/tasks/main.yml
@@ -86,8 +86,16 @@
include: set_version_rpm.yml
when: not is_containerized | bool
-- name: Set openshift_version for containerized installation
- include: set_version_containerized.yml
+- block:
+ - name: Set openshift_version for containerized installation
+ include: set_version_containerized.yml
+ - name: Determine openshift rpm version
+ include: rpm_version.yml
+ - 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 }}"
+ # Both versions have the same string representation
+ when: openshift_rpm_version != openshift_version
when: is_containerized | bool
# Warn if the user has provided an openshift_image_tag but is not doing a containerized install
diff --git a/roles/openshift_version/tasks/rpm_version.yml b/roles/openshift_version/tasks/rpm_version.yml
new file mode 100644
index 000000000..bd5e94b43
--- /dev/null
+++ b/roles/openshift_version/tasks/rpm_version.yml
@@ -0,0 +1,44 @@
+---
+# 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 c7604af1a..3cf78068b 100644
--- a/roles/openshift_version/tasks/set_version_rpm.yml
+++ b/roles/openshift_version/tasks/set_version_rpm.yml
@@ -7,42 +7,8 @@
- openshift_pkg_version is defined
- 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 }}"
- 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
- 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) }}"
+- block:
+ - include: rpm_version.yml
+ - set_fact:
+ openshift_version: "{{ openshift_rpm_version }}"
when: openshift_version is not defined