From 13b58846f6c595c9530fe49e3a00ed6f3f42a896 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Tue, 2 May 2017 13:21:51 +0200 Subject: Extend repoquery command (of lib_utils role) to ignore excluders --- roles/openshift_excluder/README.md | 13 +++++++----- roles/openshift_excluder/meta/main.yml | 1 + roles/openshift_excluder/tasks/verify_excluder.yml | 24 ++++++++++++++-------- 3 files changed, 24 insertions(+), 14 deletions(-) (limited to 'roles/openshift_excluder') diff --git a/roles/openshift_excluder/README.md b/roles/openshift_excluder/README.md index e048bd107..df45c28bf 100644 --- a/roles/openshift_excluder/README.md +++ b/roles/openshift_excluder/README.md @@ -25,16 +25,19 @@ None Dependencies ------------ +- openshift_facts +- openshift_repos +- lib_utils Tasks to include ---------------- -- exclude: enable excluders (assuming excluders are installed) -- unexclude: disable excluders (assuming excluders are installed) +- exclude: enable excluders +- unexclude: disable excluders - install: install excluders (installation is followed by excluder enabling) -- enable: enable excluders (optionally with installation step) -- disabled: disable excluders (optionally with installation and status step, the status check that can override which excluder gets enabled/disabled) -- status: determine status of excluders +- enable: enable excluders (install excluder(s) if not installed) +- disabled: disable excluders (install excluder(s) if not installed) + Example Playbook ---------------- diff --git a/roles/openshift_excluder/meta/main.yml b/roles/openshift_excluder/meta/main.yml index 4d1c1efca..c6081cdb2 100644 --- a/roles/openshift_excluder/meta/main.yml +++ b/roles/openshift_excluder/meta/main.yml @@ -14,3 +14,4 @@ galaxy_info: dependencies: - { role: openshift_facts } - { role: openshift_repos } +- { role: lib_utils } diff --git a/roles/openshift_excluder/tasks/verify_excluder.yml b/roles/openshift_excluder/tasks/verify_excluder.yml index 24a05d56e..aebdb8c58 100644 --- a/roles/openshift_excluder/tasks/verify_excluder.yml +++ b/roles/openshift_excluder/tasks/verify_excluder.yml @@ -5,15 +5,21 @@ # - openshift_upgrade_target - block: - name: Get available excluder version - command: > - {{ repoquery_cmd }} --qf '%{version}' "{{ excluder }}" - register: excluder_version - failed_when: false - changed_when: false + repoquery: + name: "{{ excluder }}" + ignore_excluders: true + register: excluder_out + + - fail: + msg: "Package {{ excluder }} not found" + when: not excluder_out.results.package_found + + - set_fact: + excluder_version: "{{ excluder_out.results.versions.available_versions.0 }}" - name: "{{ excluder }} version detected" debug: - msg: "{{ excluder }}: {{ excluder_version.stdout }}" + msg: "{{ excluder }}: {{ excluder_version }}" - name: Printing upgrade target version debug: @@ -21,9 +27,9 @@ - name: Check the available {{ excluder }} version is at most of the upgrade target version fail: - msg: "Available {{ excluder }} version {{ excluder_version.stdout }} is higher than the upgrade target version" + msg: "Available {{ excluder }} version {{ excluder_version }} is higher than the upgrade target version" when: - - "{{ excluder_version.stdout != '' }}" - - "{{ excluder_version.stdout.split('.')[0:2] | join('.') | version_compare(openshift_upgrade_target.split('.')[0:2] | join('.'), '>', strict=True) }}" + - "{{ excluder_version != '' }}" + - "{{ excluder_version.split('.')[0:2] | join('.') | version_compare(openshift_upgrade_target.split('.')[0:2] | join('.'), '>', strict=True) }}" when: - not openshift.common.is_atomic | bool -- cgit v1.2.3