mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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>
This commit is contained in:
parent
fc74f9a4f2
commit
704a3019b7
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,6 +169,10 @@ def get_package_state(names, pkg_spec, module):
|
||||||
rc, stdout, stderr = execute_command(command, module)
|
rc, stdout, stderr = execute_command(command, module)
|
||||||
|
|
||||||
if stderr:
|
if 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)
|
module.fail_json(msg="failed in get_package_state(): " + stderr)
|
||||||
|
|
||||||
if stdout:
|
if stdout:
|
||||||
|
|
Loading…
Reference in a new issue