mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-06 06:04:24 -07:00
[PR #10455/bd84f654 backport][stable-10] Improve capabilities module by detecting /sbin/getcap error message and stop early with a meaningful error message (#10562)
Improve capabilities module by detecting /sbin/getcap error message and stop early with a meaningful error message (#10455)
* modules/capabilities.py: fail & propagate if getcap command error
* Fix comment spacing (pep8)
* Add changelogs fragment for PR 10455
* Update changelogs/fragments/10455-capabilities-improve-error-detection.yml
---------
(cherry picked from commit bd84f65456
)
Co-authored-by: hakril <github@hakril.net>
Co-authored-by: clement rouault <clement.rouault@exatrack.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
69563766ec
commit
ddbfbcb47e
2 changed files with 4 additions and 0 deletions
|
@ -123,6 +123,8 @@ class CapabilitiesModule(object):
|
|||
if ' =' in stdout:
|
||||
# process output of an older version of libcap
|
||||
caps = stdout.split(' =')[1].strip().split()
|
||||
elif stdout.strip().endswith(")"): # '/foo (Error Message)'
|
||||
self.module.fail_json(msg="Unable to get capabilities of %s" % path, stdout=stdout.strip(), stderr=stderr)
|
||||
else:
|
||||
# otherwise, we have a newer version here
|
||||
# see original commit message of cap/v0.2.40-18-g177cd41 in libcap.git
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue