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.
reviewable/pr18780/r1
David Shrewsbury 9 years ago committed by Toshio Kuratomi
parent 6b8a92045f
commit 6970cc233f

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

@ -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()

@ -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()

@ -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()

@ -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()

@ -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()

Loading…
Cancel
Save