yum: disableexcludes is supported on centos6 (#51698)

* yum: disableexcludes is supported on centos6

* Add changelog
This commit is contained in:
Martin Krizek 2019-02-05 18:18:56 +01:00 committed by GitHub
parent b682381d1d
commit 33b07f322c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 60 deletions

View file

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

View file

@ -1479,9 +1479,6 @@ class YumModule(YumDnf):
self.wait_for_lock() self.wait_for_lock()
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: if error_msgs:
self.module.fail_json(msg='. '.join(error_msgs)) self.module.fail_json(msg='. '.join(error_msgs))

View file

@ -631,16 +631,6 @@
with_items: "{{ yum_version.results }}" with_items: "{{ yum_version.results }}"
- block: - 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 - name: uninstall bc
yum: name=bc state=removed yum: name=bc state=removed
@ -675,18 +665,15 @@
yum: name=bc state=latest yum: name=bc state=latest
register: yum_bc_result register: yum_bc_result
ignore_errors: True ignore_errors: True
when: supports_disable_excludes
- name: verify bc did not install because it is in exclude list - name: verify bc did not install because it is in exclude list
assert: assert:
that: that:
- "yum_bc_result is failed" - "yum_bc_result is failed"
when: supports_disable_excludes
- name: install bc with disable_excludes - name: install bc with disable_excludes
yum: name=bc state=latest disable_excludes=all yum: name=bc state=latest disable_excludes=all
register: yum_bc_result_using_excludes register: yum_bc_result_using_excludes
when: supports_disable_excludes
- name: verify bc did install using disable_excludes=all - name: verify bc did install using disable_excludes=all
assert: assert:
@ -694,7 +681,6 @@
- "yum_bc_result_using_excludes is success" - "yum_bc_result_using_excludes is success"
- "yum_bc_result_using_excludes is changed" - "yum_bc_result_using_excludes is changed"
- "yum_bc_result_using_excludes is not failed" - "yum_bc_result_using_excludes is not failed"
when: supports_disable_excludes
- name: remove exclude bc (cleanup yum.conf) - name: remove exclude bc (cleanup yum.conf)
lineinfile: lineinfile:
@ -702,7 +688,7 @@
regexp: (^exclude=bc*) regexp: (^exclude=bc*)
line: "exclude=" line: "exclude="
state: present state: present
when: supports_disable_excludes and (ansible_pkg_mgr == 'yum') when: ansible_pkg_mgr == 'yum'
- name: remove exclude bc (cleanup dnf.conf) - name: remove exclude bc (cleanup dnf.conf)
lineinfile: lineinfile:
@ -711,48 +697,6 @@
line: "excludepkgs=" line: "excludepkgs="
state: present state: present
when: ansible_pkg_mgr == 'dnf' 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 # 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 # actually honored and those releases are EOL'd so we have no expectation they