diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py index cc487af5e51..d1302854454 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py @@ -400,11 +400,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py index 2052300ff05..6d37878dcb7 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py @@ -245,11 +245,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py index 211b6c04e9a..5d77e3be040 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py @@ -450,11 +450,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py index f9f7c54bea3..e08d85eea91 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py @@ -852,11 +852,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py index 478748aeec3..7280ceff5ea 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py @@ -223,11 +223,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py index f907c0d1939..308633edd6e 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py @@ -353,11 +353,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py index b602b345677..50dd2981e72 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py @@ -627,11 +627,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py index 8606f6329d3..3cdc801746b 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py @@ -427,11 +427,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py index 0f391bc5005..f09c42f5899 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py @@ -332,11 +332,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py index c9a72c15d58..5e85a6f56e4 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py @@ -188,11 +188,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py index a62447ff6cb..6fde5a71cd2 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py @@ -428,11 +428,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py index 180e96ca6ae..28c6b3802b4 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py @@ -249,11 +249,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py index 1cd245d2b5c..8e56aafaa7e 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py @@ -623,11 +623,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py index c487dd0b4c7..15a5725bb81 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py @@ -316,11 +316,9 @@ def main(): except CloudStackException, e: module.fail_json(msg='CloudStackException: %s' % str(e)) - except Exception, e: - module.fail_json(msg='Exception: %s' % str(e)) - module.exit_json(**result) # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main()