From e9a0aff77cfc0073cc99689da9f70854d1b58813 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Tue, 10 Dec 2013 21:32:54 +1000 Subject: [PATCH] Fail EC2 inventory better with restricted EC2 users If a user has full EC2 access but no RDS access, the user should still be able to query the EC2 inventory, although will not obtain any information about any RDS instances. --- plugins/inventory/ec2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/inventory/ec2.py b/plugins/inventory/ec2.py index a38545052d7..502dc433fcd 100755 --- a/plugins/inventory/ec2.py +++ b/plugins/inventory/ec2.py @@ -295,9 +295,10 @@ class Ec2Inventory(object): for instance in instances: self.add_rds_instance(instance, region) except boto.exception.BotoServerError as e: - print "Looks like AWS RDS is down: " - print e - sys.exit(1) + if not e.reason == "Forbidden": + print "Looks like AWS RDS is down: " + print e + sys.exit(1) def get_instance(self, region, instance_id): ''' Gets details about a specific instance '''