Browse Source

Merge pull request #4400 from ingvagabund/replace-repoquery-with-module

replace repoquery with module
Jan Chaloupka 7 năm trước cách đây
mục cha
commit
705d18190f

+ 11 - 9
playbooks/common/openshift-cluster/upgrades/pre/verify_upgrade_targets.yml

@@ -14,24 +14,26 @@
 - when: not openshift.common.is_containerized | bool
   block:
   - name: Check latest available OpenShift RPM version
-    command: >
-      {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type }}"
-    failed_when: false
-    changed_when: false
-    register: avail_openshift_version
+    repoquery:
+      name: "{{ openshift.common.service_type }}"
+      ignore_excluders: true
+    register: repoquery_out
 
   - name: Fail when unable to determine available OpenShift RPM version
     fail:
       msg: "Unable to determine available OpenShift RPM version"
     when:
-    - avail_openshift_version.stdout == ''
+    - not repoquery_out.results.package_found
+
+  - name: Set fact avail_openshift_version
+    set_fact:
+      avail_openshift_version: "{{ repoquery_out.results.versions.available_versions.0 }}"
 
   - name: Verify OpenShift RPMs are available for upgrade
     fail:
-      msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but {{ openshift_upgrade_target }} or greater is required"
+      msg: "OpenShift {{ avail_openshift_version }} is available, but {{ openshift_upgrade_target }} or greater is required"
     when:
-    - not avail_openshift_version | skipped
-    - avail_openshift_version.stdout | default('0.0', True) | version_compare(openshift_release, '<')
+    - avail_openshift_version | default('0.0', True) | version_compare(openshift_release, '<')
 
 - name: Fail when openshift version does not meet minium requirement for Origin upgrade
   fail: