reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852)

This commit is contained in:
Timur Batyrshin
2014-02-02 21:33:27 +04:00
committed by James Cammarata
parent 2d0e9cd75d
commit 658c15930e
27 changed files with 118 additions and 118 deletions

View File

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