From 96780cf0351bd020d1564f6e688563e9d08a2a66 Mon Sep 17 00:00:00 2001 From: Fabio Alessandro Locati Date: Mon, 5 Dec 2016 16:21:26 +0000 Subject: [PATCH] Make `main()` calls conditional - notifications (#3656) --- lib/ansible/modules/extras/notification/flowdock.py | 4 ++-- lib/ansible/modules/extras/notification/grove.py | 4 +++- lib/ansible/modules/extras/notification/hall.py | 4 +++- lib/ansible/modules/extras/notification/irc.py | 4 +++- lib/ansible/modules/extras/notification/jabber.py | 4 +++- lib/ansible/modules/extras/notification/mail.py | 4 +++- lib/ansible/modules/extras/notification/mqtt.py | 4 +++- lib/ansible/modules/extras/notification/nexmo.py | 3 ++- lib/ansible/modules/extras/notification/osx_say.py | 4 +++- lib/ansible/modules/extras/notification/pushbullet.py | 4 +++- 10 files changed, 28 insertions(+), 11 deletions(-) diff --git a/lib/ansible/modules/extras/notification/flowdock.py b/lib/ansible/modules/extras/notification/flowdock.py index 1e1e5e9fde0..7297ef1f63a 100644 --- a/lib/ansible/modules/extras/notification/flowdock.py +++ b/lib/ansible/modules/extras/notification/flowdock.py @@ -191,5 +191,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/notification/grove.py b/lib/ansible/modules/extras/notification/grove.py index c7661456897..9db937c0cf7 100644 --- a/lib/ansible/modules/extras/notification/grove.py +++ b/lib/ansible/modules/extras/notification/grove.py @@ -114,4 +114,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/notification/hall.py b/lib/ansible/modules/extras/notification/hall.py index 23f4a0c7446..a42a2aeeeea 100755 --- a/lib/ansible/modules/extras/notification/hall.py +++ b/lib/ansible/modules/extras/notification/hall.py @@ -94,4 +94,6 @@ 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/notification/irc.py b/lib/ansible/modules/extras/notification/irc.py index 2e5cc1da14f..6678e0eb4a4 100644 --- a/lib/ansible/modules/extras/notification/irc.py +++ b/lib/ansible/modules/extras/notification/irc.py @@ -306,4 +306,6 @@ def main(): # import module snippets 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/notification/jabber.py b/lib/ansible/modules/extras/notification/jabber.py index d9fa0015157..4da7f8296fc 100644 --- a/lib/ansible/modules/extras/notification/jabber.py +++ b/lib/ansible/modules/extras/notification/jabber.py @@ -167,4 +167,6 @@ def main(): # import module snippets 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/notification/mail.py b/lib/ansible/modules/extras/notification/mail.py index fbbdcff2674..f51982f37c1 100644 --- a/lib/ansible/modules/extras/notification/mail.py +++ b/lib/ansible/modules/extras/notification/mail.py @@ -308,4 +308,6 @@ def main(): # import module snippets 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/notification/mqtt.py b/lib/ansible/modules/extras/notification/mqtt.py index af276f92540..36bbf44d7b6 100644 --- a/lib/ansible/modules/extras/notification/mqtt.py +++ b/lib/ansible/modules/extras/notification/mqtt.py @@ -207,4 +207,6 @@ def main(): # import module snippets 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/notification/nexmo.py b/lib/ansible/modules/extras/notification/nexmo.py index 89a246c0d90..fa6b0b2225a 100644 --- a/lib/ansible/modules/extras/notification/nexmo.py +++ b/lib/ansible/modules/extras/notification/nexmo.py @@ -138,4 +138,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/notification/osx_say.py b/lib/ansible/modules/extras/notification/osx_say.py index 0a64269bab4..1153a4c88dc 100644 --- a/lib/ansible/modules/extras/notification/osx_say.py +++ b/lib/ansible/modules/extras/notification/osx_say.py @@ -74,4 +74,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/notification/pushbullet.py b/lib/ansible/modules/extras/notification/pushbullet.py index 4700e63b139..6dd2c2232cb 100644 --- a/lib/ansible/modules/extras/notification/pushbullet.py +++ b/lib/ansible/modules/extras/notification/pushbullet.py @@ -184,4 +184,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() + +if __name__ == '__main__': + main()