From 0ef60aeacb0a883999d2e3d8f04731f6107f1092 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 9 Jan 2017 11:07:54 -0500 Subject: [PATCH] improved negative service status handling This is still far from optimal but the nature of the initscripts does not really allow for much better. fixes #20028 --- lib/ansible/modules/system/service.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py index 6e8406e43f..f74eed1505 100644 --- a/lib/ansible/modules/system/service.py +++ b/lib/ansible/modules/system/service.py @@ -625,11 +625,9 @@ class LinuxService(Service): cleanout = status_stdout.lower().replace(self.name.lower(), '') if "stop" in cleanout: self.running = False - elif "run" in cleanout and "not" in cleanout: - self.running = False - elif "run" in cleanout and "not" not in cleanout: - self.running = True - elif "start" in cleanout and "not" not in cleanout: + elif "run" in cleanout: + self.running = ("not " in cleanout) + elif "start" in cleanout and "not " not in cleanout: self.running = True elif 'could not access pid file' in cleanout: self.running = False