1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Wrap calls to main() with if check

A change was merged to the main Ansible core code that can cause

a potential hang if any libraries are called that use threading.

This change was:

  4b0aa1214c

This affected the os_object module by causing a hang on the shade

create_object() API call (which in turn calls swiftclient which

uses threading). The fix is to make sure all modules have a main()

that is wrapped with an "if __name__ == '__main__'" check.
This commit is contained in:
David Shrewsbury 2016-04-06 15:18:35 -04:00 committed by Matt Clay
parent ef8b59f430
commit dcbbd72cfd
6 changed files with 17 additions and 6 deletions

View file

@ -71,4 +71,5 @@ def main():
# import module snippets
from ansible.module_utils.basic import *
main()
if __name__ == "__main__":
main()

View file

@ -188,4 +188,6 @@ def main():
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
main()
if __name__ == "__main__":
main()

View file

@ -342,4 +342,6 @@ def main():
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
main()
if __name__ == "__main__":
main()

View file

@ -362,4 +362,6 @@ def main():
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
main()
if __name__ == "__main__":
main()

View file

@ -122,4 +122,6 @@ def main():
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
main()
if __name__ == "__main__":
main()

View file

@ -138,4 +138,6 @@ def main():
# this is magic, see lib/ansible/module_common.py
from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
main()
if __name__ == "__main__":
main()