From d2e49329ddc5ce75cd5ffb9492cfff23894ae031 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Tue, 12 Jan 2016 11:26:55 -0500 Subject: [PATCH] Fix old python support in scan_services Python 2.4/RHEL5 doesn't support in-line conditionals so this breaks it out into a normal multi-line condition --- awx/plugins/library/scan_services.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/plugins/library/scan_services.py b/awx/plugins/library/scan_services.py index 22a5352b2c..be343291b5 100644 --- a/awx/plugins/library/scan_services.py +++ b/awx/plugins/library/scan_services.py @@ -66,7 +66,10 @@ class ServiceScanService(BaseService): if len(line_data) < 4: continue # Skipping because we expected more data service_name = " ".join(line_data[3:]) - service_state = "running" if line_data[1] == "+" else "stopped" + if line_data[1] == "+": + service_state = "running" + else: + service_state = "stopped" services.append({"name": service_name, "state": service_state, "source": "sysv"}) rc, stdout, stderr = self.module.run_command("%s list" % initctl_path) real_stdout = stdout.replace("\r","")