From 00859a4ced88c23d2c62ef0a0c86705767df3954 Mon Sep 17 00:00:00 2001 From: Jake Morrison Date: Fri, 16 Dec 2016 13:28:06 +0800 Subject: [PATCH] Handle inability to read /proc for ansible_service_mgr. Fixes #18957 --- lib/ansible/module_utils/facts.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index ed01637b2fb..98e466ecbf6 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -335,6 +335,10 @@ class Facts(object): if re.match(r' *[0-9]+ ', proc_1): proc_1 = None + # The ps command above may return "COMMAND" if the user cannot read /proc, e.g. with grsecurity + if proc_1 == "COMMAND\n": + proc_1 = None + if proc_1 is not None: proc_1 = os.path.basename(proc_1) proc_1 = to_native(proc_1)