yum: disableexcludes is supported on centos6 (#51698)

(cherry picked from commit 33b07f322c)
pull/52044/head
Martin Krizek 6 years ago committed by Toshio Kuratomi
parent a200cfb07f
commit 1492f46d78

@ -0,0 +1,2 @@
bugfixes:
- yum - Remove incorrect disable_includes error message when using disable_excludes (https://github.com/ansible/ansible/issues/51697)

@ -1486,9 +1486,6 @@ class YumModule(YumDnf):
if not HAS_YUM_PYTHON:
error_msgs.append('The Python 2 yum module is needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.')
if self.disable_excludes and yum.__version_info__ < (3, 4):
self.module.fail_json(msg="'disable_includes' is available in yum version 3.4 and onwards.")
if error_msgs:
self.module.fail_json(msg='. '.join(error_msgs))

@ -631,16 +631,6 @@
with_items: "{{ yum_version.results }}"
- block:
- name: check whether yum supports disableexcludes (>= 3.4)
set_fact:
supports_disable_excludes: "{{ yum_version is version_compare('3.4.0', '>=') }}"
when: ansible_pkg_mgr == "yum"
- name: unset disableexcludes tests for dnf(yum4) backend temporarily
set_fact:
supports_disable_excludes: True
when: ansible_pkg_mgr == "dnf"
- name: uninstall bc
yum: name=bc state=removed
@ -675,18 +665,15 @@
yum: name=bc state=latest
register: yum_bc_result
ignore_errors: True
when: supports_disable_excludes
- name: verify bc did not install because it is in exclude list
assert:
that:
- "yum_bc_result is failed"
when: supports_disable_excludes
- name: install bc with disable_excludes
yum: name=bc state=latest disable_excludes=all
register: yum_bc_result_using_excludes
when: supports_disable_excludes
- name: verify bc did install using disable_excludes=all
assert:
@ -694,7 +681,6 @@
- "yum_bc_result_using_excludes is success"
- "yum_bc_result_using_excludes is changed"
- "yum_bc_result_using_excludes is not failed"
when: supports_disable_excludes
- name: remove exclude bc (cleanup yum.conf)
lineinfile:
@ -702,7 +688,7 @@
regexp: (^exclude=bc*)
line: "exclude="
state: present
when: supports_disable_excludes and (ansible_pkg_mgr == 'yum')
when: ansible_pkg_mgr == 'yum'
- name: remove exclude bc (cleanup dnf.conf)
lineinfile:
@ -711,48 +697,6 @@
line: "excludepkgs="
state: present
when: ansible_pkg_mgr == 'dnf'
# end test case where disable_excludes is supported
# begin test case where disable_excludes is not supported
- name: Try install bc with disable_excludes
yum: name=bc state=latest disable_excludes=all
register: yum_fail_bc_result_old_yum
ignore_errors: True
when: not supports_disable_excludes
- name: verify packages did not install because yum version is unsupported
assert:
that:
- "yum_fail_bc_result_old_yum is failed"
when: not supports_disable_excludes
- name: verify yum module outputs
assert:
that:
- "'is available in yum version 3.4 and onwards.' in yum_fail_bc_result_old_yum.msg"
when: not supports_disable_excludes
- name: remove exclude bc (cleanup yum.conf)
lineinfile:
dest: /etc/yum.conf
regexp: (^exclude=bc*)
line: "exclude="
state: present
when: not supports_disable_excludes and ansible_pkg_mgr == 'yum'
- name: install bc (bring test env in same state as when testing started)
yum: name=bc state=latest
register: yum_bc_result_old_yum
when: not supports_disable_excludes
- name: verify bc installed
assert:
that:
- "yum_bc_result_old_yum is success"
- "yum_bc_result_old_yum is changed"
- "yum_bc_result_old_yum is not failed"
when: not supports_disable_excludes and ansible_pkg_mgr == "yum"
# end test case where disable_excludes is not supported
# Fedora < 26 has a bug in dnf where package excludes in dnf.conf aren't
# actually honored and those releases are EOL'd so we have no expectation they

Loading…
Cancel
Save