[stable-2.17] package_facts: ignore warnings by apk on stderr (#83519)

* [stable-2.17] package_facts: ignore warnings by apk on stderr

Ignore warnings sent by apk cli on stderr

Partial backport of https://github.com/ansible/ansible/pull/83149

Fixes: #83501

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* CI fixes

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/83565/head
Abhijeet Kasurde 5 months ago committed by GitHub
parent 9f9238373e
commit d1c94fe110
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
---
bugfixes:
- package_facts - ignore warnings sent by apk on stderr (https://github.com/ansible/ansible/issues/83501).

@ -440,7 +440,7 @@ class APK(CLIMgr):
def list_installed(self): def list_installed(self):
rc, out, err = module.run_command([self._cli, 'info', '-v']) rc, out, err = module.run_command([self._cli, 'info', '-v'])
if rc != 0 or err: if rc != 0:
raise Exception("Unable to list packages rc=%s : %s" % (rc, err)) raise Exception("Unable to list packages rc=%s : %s" % (rc, err))
return out.splitlines() return out.splitlines()

@ -65,6 +65,19 @@
that: ansible_facts.packages is defined that: ansible_facts.packages is defined
when: (ansible_os_family == "openSUSE Leap") or (ansible_os_family == "Suse") when: (ansible_os_family == "openSUSE Leap") or (ansible_os_family == "Suse")
- name: Same as those above, but based on pkg_mgr
block:
- name: Gather package facts
package_facts:
manager: '{{ ansible_facts["pkg_mgr"] }}'
- name: check for ansible_facts.packages exists
assert:
that:
- ansible_facts.packages is defined
- ansible_facts.packages | length > 1
when: ansible_facts['os_family'] in ["openSUSE Leap", "Suse", "Debian"]
# Check that auto detection works also # Check that auto detection works also
- name: Gather package facts - name: Gather package facts
package_facts: package_facts:

Loading…
Cancel
Save