mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
pacman: add support for remove_nosave (#4316)
* pacman: add support for remove_nosave New parameter: remove_nosave When enabled, will pass --nosave to pacman when removing packages. --nosave cannot be used with --print-format and thus it couldn't be passed via extra_args. See #4315 The code adds the option right before the actual removal of the pkgs. (This is based on an initial diff from MorphBonehunter) * changelog * Update plugins/modules/packaging/os/pacman.py Co-authored-by: Felix Fontein <felix@fontein.de> * wording * ssss * remove_package: simplify {force,extra,nosave}_args Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
c0f53d60c4
commit
c698ecd201
4 changed files with 94 additions and 13 deletions
|
@ -9,3 +9,4 @@
|
|||
# Add more tests here by including more task files:
|
||||
- include: 'basic.yml'
|
||||
- include: 'package_urls.yml'
|
||||
- include: 'remove_nosave.yml'
|
||||
|
|
70
tests/integration/targets/pacman/tasks/remove_nosave.yml
Normal file
70
tests/integration/targets/pacman/tasks/remove_nosave.yml
Normal file
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
- vars:
|
||||
package_name: xinetd
|
||||
config_file: /etc/xinetd.conf
|
||||
block:
|
||||
- name: Make sure that {{ package_name }} is not installed
|
||||
pacman:
|
||||
name: '{{ package_name }}'
|
||||
state: absent
|
||||
- name: Make sure {{config_file}}.pacsave file doesn't exist
|
||||
file:
|
||||
path: '{{config_file}}.pacsave'
|
||||
state: absent
|
||||
|
||||
- name: Install {{ package_name }}
|
||||
pacman:
|
||||
name: '{{ package_name }}'
|
||||
state: present
|
||||
|
||||
- name: Modify {{config_file}}
|
||||
blockinfile:
|
||||
path: '{{config_file}}'
|
||||
block: |
|
||||
# something something
|
||||
# on 2 lines
|
||||
|
||||
- name: Remove {{ package_name }} - generate pacsave
|
||||
pacman:
|
||||
name: '{{ package_name }}'
|
||||
state: absent
|
||||
- name: Make sure {{config_file}}.pacsave exists
|
||||
stat:
|
||||
path: '{{config_file}}.pacsave'
|
||||
register: pacsave_st_1
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- pacsave_st_1.stat.exists
|
||||
|
||||
- name: Delete {{config_file}}.pacsave
|
||||
file:
|
||||
path: '{{config_file}}.pacsave'
|
||||
state: absent
|
||||
|
||||
- name: Install {{ package_name }}
|
||||
pacman:
|
||||
name: '{{ package_name }}'
|
||||
state: present
|
||||
|
||||
- name: Modify {{config_file}}
|
||||
blockinfile:
|
||||
path: '{{config_file}}'
|
||||
block: |
|
||||
# something something
|
||||
# on 2 lines
|
||||
|
||||
- name: Remove {{ package_name }} - nosave
|
||||
pacman:
|
||||
name: '{{ package_name }}'
|
||||
remove_nosave: yes
|
||||
state: absent
|
||||
|
||||
- name: Make sure {{config_file}}.pacsave does not exist
|
||||
stat:
|
||||
path: '{{config_file}}.pacsave'
|
||||
register: pacsave_st_2
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- not pacsave_st_2.stat.exists
|
Loading…
Add table
Add a link
Reference in a new issue