From 86f08bfcda17e95fb284f9a8b7c0a3cbf518173b Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Mon, 25 Apr 2016 12:34:18 -0700 Subject: [PATCH] Adds the __main__ conditional check (#2098) As is done in other ansible modules, this adds the __main__ check to the module so that the module code itself can be used as a library. For instance, when testing the code. --- network/f5/bigip_facts.py | 1 - network/f5/bigip_monitor_http.py | 3 ++- network/f5/bigip_monitor_tcp.py | 3 ++- network/f5/bigip_node.py | 3 ++- network/f5/bigip_pool.py | 4 +++- network/f5/bigip_pool_member.py | 4 +++- network/f5/bigip_virtual_server.py | 1 - 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/network/f5/bigip_facts.py b/network/f5/bigip_facts.py index 9a2f5abdbf4..0f121b2a3aa 100644 --- a/network/f5/bigip_facts.py +++ b/network/f5/bigip_facts.py @@ -1687,4 +1687,3 @@ from ansible.module_utils.f5 import * if __name__ == '__main__': main() - diff --git a/network/f5/bigip_monitor_http.py b/network/f5/bigip_monitor_http.py index cfafbad9be1..166b7ae32e0 100644 --- a/network/f5/bigip_monitor_http.py +++ b/network/f5/bigip_monitor_http.py @@ -445,5 +445,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.f5 import * -main() +if __name__ == '__main__': + main() diff --git a/network/f5/bigip_monitor_tcp.py b/network/f5/bigip_monitor_tcp.py index 564f4564283..b06c8978106 100644 --- a/network/f5/bigip_monitor_tcp.py +++ b/network/f5/bigip_monitor_tcp.py @@ -469,5 +469,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.f5 import * -main() +if __name__ == '__main__': + main() diff --git a/network/f5/bigip_node.py b/network/f5/bigip_node.py index 89c17e57735..c6c32a38858 100644 --- a/network/f5/bigip_node.py +++ b/network/f5/bigip_node.py @@ -379,5 +379,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.f5 import * -main() +if __name__ == '__main__': + main() diff --git a/network/f5/bigip_pool.py b/network/f5/bigip_pool.py index 014545c7c3b..85fbc5b9c0d 100644 --- a/network/f5/bigip_pool.py +++ b/network/f5/bigip_pool.py @@ -521,4 +521,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.f5 import * -main() + +if __name__ == '__main__': + main() diff --git a/network/f5/bigip_pool_member.py b/network/f5/bigip_pool_member.py index a0a1172801e..50abef420e7 100644 --- a/network/f5/bigip_pool_member.py +++ b/network/f5/bigip_pool_member.py @@ -438,4 +438,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.f5 import * -main() + +if __name__ == '__main__': + main() diff --git a/network/f5/bigip_virtual_server.py b/network/f5/bigip_virtual_server.py index 26772f4bca7..b654e5f84f8 100644 --- a/network/f5/bigip_virtual_server.py +++ b/network/f5/bigip_virtual_server.py @@ -469,4 +469,3 @@ from ansible.module_utils.f5 import * if __name__ == '__main__': main() -