mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
75f933cf64
commit
576832e4c9
1 changed files with 2 additions and 0 deletions
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue