From 3d30ad2db200f331010e5706831ee045cd89abb4 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 23 Nov 2015 14:22:36 -0500 Subject: [PATCH] Updates for fixes on the core ec2 inventory module Inventory syncs will still fail if you specify an instance_filter. We need to check: https://github.com/ansible/ansible/pull/13178 For the moment I'm making sure we specifically disable elasticache querying but it still yields an error. Will follow up with: https://trello.com/c/h1U0w4WC/138-ec2-module-is-busted-if-you-set-instance-filters --- awx/main/tasks.py | 1 + awx/plugins/inventory/ec2.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 93303f511c..eef1590d1a 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1101,6 +1101,7 @@ class RunInventoryUpdate(BaseTask): ec2_opts.setdefault('all_rds_instances', 'False') ec2_opts.setdefault('rds', 'False') ec2_opts.setdefault('nested_groups', 'True') + ec2_opts.setdefault('elasticache', 'False') if inventory_update.instance_filters: ec2_opts.setdefault('instance_filters', inventory_update.instance_filters) group_by = [x.strip().lower() for x in inventory_update.group_by.split(',') if x.strip()] diff --git a/awx/plugins/inventory/ec2.py b/awx/plugins/inventory/ec2.py index b8b1d43dea..cab0d2b85c 100755 --- a/awx/plugins/inventory/ec2.py +++ b/awx/plugins/inventory/ec2.py @@ -505,7 +505,7 @@ class Ec2Inventory(object): # that's why we need to call describe directly (it would be called by # the shorthand method anyway...) try: - conn = elasticache.connect_to_region(region) + conn = self.connect_to_aws(elasticache, region) if conn: # show_cache_node_info = True # because we also want nodes' information @@ -541,7 +541,7 @@ class Ec2Inventory(object): # that's why we need to call describe directly (it would be called by # the shorthand method anyway...) try: - conn = elasticache.connect_to_region(region) + conn = self.connect_to_aws(elasticache, region) if conn: response = conn.describe_replication_groups()