From f956ec15fa6309f876ca6eb31fe2c3764772a183 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Tue, 19 Jan 2016 09:54:25 -0500 Subject: [PATCH] Add special case to scan_services that fixes SLES11 scan failure issue --- awx/plugins/library/scan_services.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/awx/plugins/library/scan_services.py b/awx/plugins/library/scan_services.py index be343291b5..accbd232b4 100644 --- a/awx/plugins/library/scan_services.py +++ b/awx/plugins/library/scan_services.py @@ -97,6 +97,13 @@ class ServiceScanService(BaseService): #print '%s --status-all | grep -E "is (running|stopped)"' % service_path p = re.compile('(?P.*?)\s+[0-9]:(?Pon|off)\s+[0-9]:(?Pon|off)\s+[0-9]:(?Pon|off)\s+[0-9]:(?Pon|off)\s+[0-9]:(?Pon|off)\s+[0-9]:(?Pon|off)\s+[0-9]:(?Pon|off)') rc, stdout, stderr = self.module.run_command('%s' % chkconfig_path, use_unsafe_shell=True) + # extra flags needed for SLES11 + if not any(p.match(line) for line in stdout.split('\n')): + # If p pattern is not found but p_simple is, we have single-column ouptut + p_simple = re.compile('(?P.*?)\s+(?Pon|off)') + if any(p_simple.match(line) for line in stdout.split('\n')): + # Try extra flags " -l --allservices" to output all columns + rc, stdout, stderr = self.module.run_command('%s -l --allservices' % chkconfig_path, use_unsafe_shell=True) for line in stdout.split('\n'): m = p.match(line) if m: