-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* pacman: re-adding support for URL based pkgs * Update plugins/modules/packaging/os/pacman.py Co-authored-by: Felix Fontein <[email protected]> * Update plugins/modules/packaging/os/pacman.py Co-authored-by: Felix Fontein <[email protected]> * cmd=cmd in every call to self.fail() * pacman: integration test for mixed pkg sources * Add more tests + fix minor bug with URL packages Version checking for URL packages is left to pacman, so add a check after the dry run to see if it would actually install anything. * remove double templating Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit a9db474) Co-authored-by: Jean Raby <[email protected]>
- Loading branch information
1 parent
deb95ea
commit 391c3aa
Showing
5 changed files
with
300 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bugfixes: | ||
- pacman - fix URL based package installation | ||
(https://github.com/ansible-collections/community.general/pull/4286, https://github.com/ansible-collections/community.general/issues/4285). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
block: | ||
# Add more tests here by including more task files: | ||
- include: 'basic.yml' | ||
- include: 'package_urls.yml' |
125 changes: 125 additions & 0 deletions
125
tests/integration/targets/pacman/tasks/package_urls.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
- vars: | ||
reg_pkg: ed | ||
url_pkg: lemon | ||
file_pkg: hdparm | ||
file_pkg_path: /tmp/pkg.zst | ||
extra_pkg: core/sdparm | ||
extra_pkg_outfmt: sdparm | ||
block: | ||
- name: Make sure that test packages are not installed | ||
pacman: | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg}}' | ||
- '{{file_pkg}}' | ||
- '{{extra_pkg}}' | ||
state: absent | ||
|
||
- name: Get URL for {{url_pkg}} | ||
command: | ||
cmd: pacman --sync --print-format "%l" {{url_pkg}} | ||
register: url_pkg_url | ||
|
||
- name: Get URL for {{file_pkg}} | ||
command: | ||
cmd: pacman --sync --print-format "%l" {{file_pkg}} | ||
register: file_pkg_url | ||
- name: Download {{file_pkg}} pkg | ||
get_url: | ||
url: '{{file_pkg_url.stdout}}' | ||
dest: '{{file_pkg_path}}' | ||
|
||
- name: Install packages from mixed sources (check mode) | ||
pacman: | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
check_mode: True | ||
register: install_1 | ||
|
||
- name: Install packages from mixed sources | ||
pacman: | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
register: install_2 | ||
|
||
- name: Install packages from mixed sources - (idempotency) | ||
pacman: | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
register: install_3 | ||
|
||
- name: Install packages with their regular names (idempotency) | ||
pacman: | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg}}' | ||
- '{{file_pkg}}' | ||
register: install_4 | ||
|
||
- name: Install new package with already installed packages from mixed sources | ||
pacman: | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
- '{{extra_pkg}}' | ||
register: install_5 | ||
|
||
- name: Uninstall packages - mixed sources (check mode) | ||
pacman: | ||
state: absent | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
check_mode: True | ||
register: uninstall_1 | ||
|
||
- name: Uninstall packages - mixed sources | ||
pacman: | ||
state: absent | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
register: uninstall_2 | ||
|
||
- name: Uninstall packages - mixed sources (idempotency) | ||
pacman: | ||
state: absent | ||
name: | ||
- '{{reg_pkg}}' | ||
- '{{url_pkg_url.stdout}}' | ||
- '{{file_pkg_path}}' | ||
register: uninstall_3 | ||
|
||
- assert: | ||
that: | ||
- install_1 is changed | ||
- install_1.msg == 'Would have installed 3 packages' | ||
- install_1.packages|sort() == [reg_pkg, url_pkg, file_pkg]|sort() | ||
- install_2 is changed | ||
- install_2.msg == 'Installed 3 package(s)' | ||
- install_1.packages|sort() == [reg_pkg, url_pkg, file_pkg]|sort() | ||
- install_3 is not changed | ||
- install_3.msg == 'package(s) already installed' | ||
- install_4 is not changed | ||
- install_4.msg == 'package(s) already installed' | ||
- install_5 is changed | ||
- install_5.msg == 'Installed 1 package(s)' | ||
- install_5.packages == [extra_pkg_outfmt] | ||
- uninstall_1 is changed | ||
- uninstall_1.msg == 'Would have removed 3 packages' | ||
- uninstall_1.packages | length() == 3 # pkgs have versions here | ||
- uninstall_2 is changed | ||
- uninstall_2.msg == 'Removed 3 package(s)' | ||
- uninstall_2.packages | length() == 3 | ||
- uninstall_3 is not changed | ||
- uninstall_3.msg == 'package(s) already absent' |
Oops, something went wrong.