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 Toshio Kuratomi
parent 6b8a92045f
commit 6970cc233f
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

@ -344,4 +344,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

@ -365,4 +365,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

@ -139,4 +139,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()