diff --git a/lib/ansible/modules/web_infrastructure/nginx_status_facts.py b/lib/ansible/modules/web_infrastructure/nginx_status_facts.py index dd2fbd5ee1..c697721b3c 100644 --- a/lib/ansible/modules/web_infrastructure/nginx_status_facts.py +++ b/lib/ansible/modules/web_infrastructure/nginx_status_facts.py @@ -135,7 +135,9 @@ class NginxStatusFacts(object): return result result['nginx_status_facts']['data'] = data - match = re.match(r'Active connections: ([0-9]+) \nserver accepts handled requests\n ([0-9]+) ([0-9]+) ([0-9]+) \nReading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)', data, re.S) + expr = r'Active connections: ([0-9]+) \nserver accepts handled requests\n ([0-9]+) ([0-9]+) ([0-9]+) \n' \ + r'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)' + match = re.match(expr, data, re.S) if match: result['nginx_status_facts']['active_connections'] = int(match.group(1)) result['nginx_status_facts']['accepts'] = int(match.group(2)) @@ -146,6 +148,7 @@ class NginxStatusFacts(object): result['nginx_status_facts']['waiting'] = int(match.group(7)) return result + def main(): global module module = AnsibleModule( @@ -160,5 +163,6 @@ def main(): result = dict(changed=False, ansible_facts=nginx_status_facts) module.exit_json(**result) + if __name__ == '__main__': main() diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 4d8e57829e..427f6f19e2 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -199,7 +199,6 @@ lib/ansible/modules/utilities/logic/wait_for.py lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py lib/ansible/modules/web_infrastructure/django_manage.py lib/ansible/modules/web_infrastructure/jira.py -lib/ansible/modules/web_infrastructure/nginx_status_facts.py lib/ansible/modules/windows/win_acl.py lib/ansible/modules/windows/win_acl_inheritance.py lib/ansible/modules/windows/win_command.py