Skip to content

Commit 0cff5de

Browse files
[PR #11265/d4249071 backport][stable-12] apk: fix packages return value for apk-tools >= 3 (fix #11264) (#11272)
apk: fix packages return value for apk-tools >= 3 (fix #11264) (#11265) * apk: fix packages return value for apk-tools >= 3 (fix #11264) * Add changelog fragment (cherry picked from commit d424907) Co-authored-by: s-hamann <[email protected]>
1 parent 0280b1c commit 0cff5de

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
bugfixes:
3+
- apk - fix ``packages`` return value for apk-tools >= 3 (Alpine 3.23) (https://github.com/ansible-collections/community.general/issues/11264).

plugins/modules/apk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
def parse_for_packages(stdout):
175175
packages = []
176176
data = stdout.split("\n")
177-
regex = re.compile(r"^\(\d+/\d+\)\s+\S+\s+(\S+)")
177+
regex = re.compile(r"^\(\s*\d+/\d+\)\s+\S+\s+(\S+)")
178178
for l in data:
179179
p = regex.search(l)
180180
if p:

tests/integration/targets/apk/tasks/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,21 @@
8989
- less
9090
- nano
9191
- vim
92+
- bash
93+
- bash-completion
94+
- bash-completion-doc
95+
- zsh
96+
- zsh-calendar
97+
- zsh-completions
98+
- zsh-doc
9299
state: present
93100
register: results
94101

95102
- name: Ensure a bunch of packages were installed
96103
ansible.builtin.assert:
97104
that:
98105
- results is changed
99-
- (results.packages | length) >= 3
106+
- (results.packages | length) >= 10
100107

101108
- name: Install a bunch of packages again
102109
community.general.apk:

0 commit comments

Comments
 (0)