mirror of https://github.com/ansible/ansible.git
[dnf] Make "remove" filtering closer to dnf CLI (#73033)
Change: - Internally, use dnf.subject.Subject#get_best_query for state: absent - Add a bunch of tests for removing packages, given a bunch of different pkg specs (nv, nvr, nvra, wildcard, etc.) Test Plan: - New tests - Local experiments with DNF API via PDB. Tickets: - Fixes #72809 Signed-off-by: Rick Elrod <rick@elrod.me>pull/72097/merge
parent
77942acefc
commit
44ee04bd1f
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- "dnf - When ``state: absent``, package names are now matched similarly to how the ``dnf`` CLI matches them (https://github.com/ansible/ansible/issues/72809)."
|
@ -0,0 +1,19 @@
|
|||||||
|
# These are safe to just check in check_mode, because in the module, the
|
||||||
|
# logic to match packages will happen anyway. check_mode will just prevent
|
||||||
|
# the transaction from actually running once the matches are found.
|
||||||
|
- name: Remove {{ item }}
|
||||||
|
dnf:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
check_mode: true
|
||||||
|
register: sos_rm
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
var: sos_rm
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- sos_rm is successful
|
||||||
|
- sos_rm is changed
|
||||||
|
- "'Removed: sos-{{ sos_version }}-{{ sos_release }}' in sos_rm.results[0]"
|
||||||
|
- sos_rm.results|length == 1
|
Loading…
Reference in New Issue