diff options
author | Johannes Heimansberg <git@jhe.dedyn.io> | 2021-06-03 15:59:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 09:59:31 -0400 |
commit | b023f34f4a31c91ff842bae54174c97ae03a57af (patch) | |
tree | f4400880d55f4cd52139cf19a1093d7ed65673f4 /lib/ansible/module_utils/facts/system | |
parent | 9c718ccc4288473d44ebf13599a409913d43e3cc (diff) | |
download | ansible-b023f34f4a31c91ff842bae54174c97ae03a57af.tar.gz |
service_mgr: Detect using symlink if proc/1 and ps fail
* runit and other alternative service managers tend to work via symlink so this covers most of em
* Fixes #74866.
Diffstat (limited to 'lib/ansible/module_utils/facts/system')
-rw-r--r-- | lib/ansible/module_utils/facts/system/service_mgr.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/facts/system/service_mgr.py b/lib/ansible/module_utils/facts/system/service_mgr.py index ae85bfa760..f0b9e0154c 100644 --- a/lib/ansible/module_utils/facts/system/service_mgr.py +++ b/lib/ansible/module_utils/facts/system/service_mgr.py @@ -98,6 +98,9 @@ class ServiceMgrFactCollector(BaseFactCollector): if proc_1 == "COMMAND\n": proc_1 = None + if proc_1 is None and os.path.islink('/sbin/init'): + proc_1 = os.readlink('/sbin/init') + # FIXME: empty string proc_1 staus empty string if proc_1 is not None: proc_1 = os.path.basename(proc_1) |