Respect profiles & credentials for boto3 inventory

Using boto3 directly wasn't properly using profiles set in the `ec2.ini`
file, this change uses the `module_utils` boto3_conn instead.
pull/16606/head
Ryan S. Brown 9 years ago
parent 418f91d0e2
commit 59e499f8f0

@ -131,6 +131,8 @@ from boto import elasticache
from boto import route53
import six
from ansible.module_utils import ec2 as ec2_utils
HAS_BOTO3 = False
try:
import boto3
@ -591,9 +593,10 @@ class Ec2Inventory(object):
def include_rds_clusters_by_region(self, region):
if not HAS_BOTO3:
module.fail_json(message="This module requires boto3 be installed - please install boto3 and try again")
self.fail_with_error("Working with RDS clusters requires boto3 - please install boto3 and try again",
"getting RDS clusters")
client = self.connect_to_aws(rds, region)
client = ec2_utils.boto3_inventory_conn('client', 'rds', region, **self.credentials)
clusters = client.describe_db_clusters()["DBClusters"]
account_id = boto.connect_iam().get_user().arn.split(':')[4]
c_dict = {}

Loading…
Cancel
Save