mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #6785/704a3019 backport][stable-6] Handle pkg_info(1) error message "Can't find" (#6892)
Handle pkg_info(1) error message "Can't find" (#6785)
* Handle pkg_info(1) error message "Can't find"
* Update plugins/modules/openbsd_pkg.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 704a3019b7
)
Co-authored-by: Rafael Sadowski <rafael@sizeofvoid.org>
This commit is contained in:
parent
9ecfa370ff
commit
1a4ae5e9aa
2 changed files with 7 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- openbsd_pkg - the pkg_info(1) behavior has changed in OpenBSD >7.3. The error message ``Can't find`` should not lead to an error case (https://github.com/ansible-collections/community.general/pull/6785).
|
|
@ -169,7 +169,11 @@ def get_package_state(names, pkg_spec, module):
|
|||
rc, stdout, stderr = execute_command(command, module)
|
||||
|
||||
if stderr:
|
||||
module.fail_json(msg="failed in get_package_state(): " + stderr)
|
||||
match = re.search(r"^Can't find inst:%s$" % re.escape(name), stderr)
|
||||
if match:
|
||||
pkg_spec[name]['installed_state'] = False
|
||||
else:
|
||||
module.fail_json(msg="failed in get_package_state(): " + stderr)
|
||||
|
||||
if stdout:
|
||||
# If the requested package name is just a stem, like "python", we may
|
||||
|
|
Loading…
Reference in a new issue