From af2cc5587132427faae21785599280b1f05e6cda Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 15:15:50 -0300 Subject: Restore 3.2 RPM version check before upgrading. --- .../openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index c2847e163..9cba1b40b 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -144,11 +144,26 @@ docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool - - name: Verify RPMs are available for upgrade + - set_fact: + repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}" + when: not openshift.common.is_containerized | bool + + - name: Check latest available OpenShift RPM version command: > - yum list available -e 0 -q "{{ g_new_service_name }}" 2>&1 | tail -n +2 | grep -v 'el7ose' | awk '{ print $2 }' | sort -r | tr '\n' ' ') + {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type }}" + failed_when: false + changed_when: false + register: avail_openshift_version when: not openshift.common.is_containerized | bool + - debug: var=avail_openshift_version + + - name: Verify OpenShift 3.2 RPMs are available for upgrade + fail: + msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but 3.2 or greater is required" + when: not openshift.common.is_containerized | bool and not avail_openshift_version | skipped and avail_openshift_version.stdout | default('0.0', True) | version_compare('3.2', '<') + + # TODO: Are these two grep checks necessary anymore? # Note: the version number is hardcoded here in hopes of catching potential # bugs in how g_aos_versions.curr_version is set -- cgit v1.2.3