summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Johansson <kim@detectify.com>2015-03-27 10:46:01 +0100
committerKim Johansson <kim@detectify.com>2015-03-27 10:46:01 +0100
commit576832e4c9224caaed8826f83e3b12a430e68277 (patch)
tree1f81a449402f7b39a79fe25dd723f51d0102b2c2
parent75f933cf6454d770ed782e7f931090954cc8dbf9 (diff)
downloadansible-576832e4c9224caaed8826f83e3b12a430e68277.tar.gz
Always define error before using it
When the error reason is "Forbidden", the code throws a Python exception rather than simply outputting the exception reason. It's not nice to throw a Python exception when all the info to display a proper message is available.
-rwxr-xr-xplugins/inventory/ec2.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py
index 5f7bd061d7..e93df1053d 100755
--- a/plugins/inventory/ec2.py
+++ b/plugins/inventory/ec2.py
@@ -382,6 +382,8 @@ class Ec2Inventory(object):
for instance in instances:
self.add_rds_instance(instance, region)
except boto.exception.BotoServerError, e:
+ error = e.reason
+
if e.error_code == 'AuthFailure':
error = self.get_auth_error_message()
if not e.reason == "Forbidden":