cloudstack: update code to match best practice

* Remove catchall exception
* use `if __name__ == '__main__':`
This commit is contained in:
Rene Moser 2015-06-28 12:52:05 +02:00 committed by Matt Clay
parent 4020ebaecf
commit 1aa4d0c2dd
14 changed files with 28 additions and 56 deletions

View file

@ -400,11 +400,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -245,11 +245,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -450,11 +450,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -852,11 +852,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -223,11 +223,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -353,11 +353,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -627,11 +627,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -427,11 +427,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -332,11 +332,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -188,11 +188,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -428,11 +428,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -249,11 +249,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -623,11 +623,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()

View file

@ -316,11 +316,9 @@ def main():
except CloudStackException, e: except CloudStackException, e:
module.fail_json(msg='CloudStackException: %s' % str(e)) module.fail_json(msg='CloudStackException: %s' % str(e))
except Exception, e:
module.fail_json(msg='Exception: %s' % str(e))
module.exit_json(**result) module.exit_json(**result)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() if __name__ == '__main__':
main()