mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852)
This commit is contained in:
committed by
James Cammarata
parent
2d0e9cd75d
commit
658c15930e
@@ -107,9 +107,9 @@ def main():
|
||||
service_type='compute')
|
||||
try:
|
||||
nova.authenticate()
|
||||
except exc.Unauthorized as e:
|
||||
except exc.Unauthorized, e:
|
||||
module.fail_json(msg = "Invalid OpenStack Nova credentials.: %s" % e.message)
|
||||
except exc.AuthorizationFailure as e:
|
||||
except exc.AuthorizationFailure, e:
|
||||
module.fail_json(msg = "Unable to authorize user: %s" % e.message)
|
||||
|
||||
if module.params['state'] == 'present':
|
||||
@@ -118,7 +118,7 @@ def main():
|
||||
module.exit_json(changed = False, result = "Key present")
|
||||
try:
|
||||
key = nova.keypairs.create(module.params['name'], module.params['public_key'])
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.exit_json(msg = "Error in creating the keypair: %s" % e.message)
|
||||
if not module.params['public_key']:
|
||||
module.exit_json(changed = True, key = key.private_key)
|
||||
@@ -128,7 +128,7 @@ def main():
|
||||
if key.name == module.params['name']:
|
||||
try:
|
||||
nova.keypairs.delete(module.params['name'])
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json(msg = "The keypair deletion has failed: %s" % e.message)
|
||||
module.exit_json( changed = True, result = "deleted")
|
||||
module.exit_json(changed = False, result = "not present")
|
||||
|
||||
Reference in New Issue
Block a user