mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 10:21:25 -07: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
|
@ -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…
Add table
Add a link
Reference in a new issue