From 9f7ad2ca3b205ea88705ac1a8a2f694f4312f044 Mon Sep 17 00:00:00 2001 From: Fabio Alessandro Locati Date: Mon, 5 Dec 2016 16:22:17 +0000 Subject: [PATCH] Conditional main - monitoring (#3648) --- lib/ansible/modules/extras/monitoring/airbrake_deployment.py | 4 ++-- lib/ansible/modules/extras/monitoring/logentries.py | 3 ++- lib/ansible/modules/extras/monitoring/monit.py | 3 ++- lib/ansible/modules/extras/monitoring/nagios.py | 4 +++- lib/ansible/modules/extras/monitoring/newrelic_deployment.py | 4 ++-- lib/ansible/modules/extras/monitoring/pagerduty.py | 3 ++- lib/ansible/modules/extras/monitoring/pingdom.py | 4 +++- lib/ansible/modules/extras/monitoring/sensu_check.py | 4 +++- lib/ansible/modules/extras/monitoring/zabbix_group.py | 4 +++- lib/ansible/modules/extras/monitoring/zabbix_host.py | 4 +++- lib/ansible/modules/extras/monitoring/zabbix_hostmacro.py | 3 ++- lib/ansible/modules/extras/monitoring/zabbix_maintenance.py | 4 +++- 12 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/ansible/modules/extras/monitoring/airbrake_deployment.py b/lib/ansible/modules/extras/monitoring/airbrake_deployment.py index 282d4c60d30..d6daec2ceb4 100644 --- a/lib/ansible/modules/extras/monitoring/airbrake_deployment.py +++ b/lib/ansible/modules/extras/monitoring/airbrake_deployment.py @@ -128,5 +128,5 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.urls import * -main() - +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/logentries.py b/lib/ansible/modules/extras/monitoring/logentries.py index f4e3fef3294..c772b6a1cd0 100644 --- a/lib/ansible/modules/extras/monitoring/logentries.py +++ b/lib/ansible/modules/extras/monitoring/logentries.py @@ -152,4 +152,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/monit.py b/lib/ansible/modules/extras/monitoring/monit.py index eafa3e02b77..f7c46b86bec 100644 --- a/lib/ansible/modules/extras/monitoring/monit.py +++ b/lib/ansible/modules/extras/monitoring/monit.py @@ -184,4 +184,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/nagios.py b/lib/ansible/modules/extras/monitoring/nagios.py index 7de284449c8..37cf4bbe408 100644 --- a/lib/ansible/modules/extras/monitoring/nagios.py +++ b/lib/ansible/modules/extras/monitoring/nagios.py @@ -1077,4 +1077,6 @@ class Nagios(object): ###################################################################### # import module snippets from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/newrelic_deployment.py b/lib/ansible/modules/extras/monitoring/newrelic_deployment.py index 6224fbf48d7..4d47169e89c 100644 --- a/lib/ansible/modules/extras/monitoring/newrelic_deployment.py +++ b/lib/ansible/modules/extras/monitoring/newrelic_deployment.py @@ -144,5 +144,5 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.urls import * -main() - +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/pagerduty.py b/lib/ansible/modules/extras/monitoring/pagerduty.py index 43b2af94a12..a6d6da7d72b 100644 --- a/lib/ansible/modules/extras/monitoring/pagerduty.py +++ b/lib/ansible/modules/extras/monitoring/pagerduty.py @@ -307,4 +307,5 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.urls import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/pingdom.py b/lib/ansible/modules/extras/monitoring/pingdom.py index 77d23b53ffc..e9511831aab 100644 --- a/lib/ansible/modules/extras/monitoring/pingdom.py +++ b/lib/ansible/modules/extras/monitoring/pingdom.py @@ -149,4 +149,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/sensu_check.py b/lib/ansible/modules/extras/monitoring/sensu_check.py index 6ded2aae8ca..9acbfefa837 100644 --- a/lib/ansible/modules/extras/monitoring/sensu_check.py +++ b/lib/ansible/modules/extras/monitoring/sensu_check.py @@ -393,4 +393,6 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.pycompat24 import get_exception -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/zabbix_group.py b/lib/ansible/modules/extras/monitoring/zabbix_group.py index ec1f65ed358..2dd8d98331e 100644 --- a/lib/ansible/modules/extras/monitoring/zabbix_group.py +++ b/lib/ansible/modules/extras/monitoring/zabbix_group.py @@ -222,4 +222,6 @@ def main(): module.exit_json(changed=False) from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/zabbix_host.py b/lib/ansible/modules/extras/monitoring/zabbix_host.py index 34b68c78b9f..611a5f9faa1 100644 --- a/lib/ansible/modules/extras/monitoring/zabbix_host.py +++ b/lib/ansible/modules/extras/monitoring/zabbix_host.py @@ -574,4 +574,6 @@ def main(): host_name, ip, link_templates)) from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/zabbix_hostmacro.py b/lib/ansible/modules/extras/monitoring/zabbix_hostmacro.py index 7ef9755a789..39aaccce9e8 100644 --- a/lib/ansible/modules/extras/monitoring/zabbix_hostmacro.py +++ b/lib/ansible/modules/extras/monitoring/zabbix_hostmacro.py @@ -237,5 +237,6 @@ def main(): host_macro_class_obj.update_host_macro(host_macro_obj, macro_name, macro_value) from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/zabbix_maintenance.py b/lib/ansible/modules/extras/monitoring/zabbix_maintenance.py index 247b0a8e717..7fe0a494609 100644 --- a/lib/ansible/modules/extras/monitoring/zabbix_maintenance.py +++ b/lib/ansible/modules/extras/monitoring/zabbix_maintenance.py @@ -382,4 +382,6 @@ def main(): module.exit_json(changed=changed) from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main()