|
|
|
@ -782,13 +782,26 @@ class Ec2Inventory(object):
|
|
|
|
|
# ElastiCache boto module doesn't provide a get_all_instances method,
|
|
|
|
|
# that's why we need to call describe directly (it would be called by
|
|
|
|
|
# the shorthand method anyway...)
|
|
|
|
|
clusters = []
|
|
|
|
|
try:
|
|
|
|
|
conn = self.connect_to_aws(elasticache, region)
|
|
|
|
|
if conn:
|
|
|
|
|
# show_cache_node_info = True
|
|
|
|
|
# because we also want nodes' information
|
|
|
|
|
response = conn.describe_cache_clusters(None, None, None, True)
|
|
|
|
|
|
|
|
|
|
_marker = 1
|
|
|
|
|
while _marker:
|
|
|
|
|
if _marker == 1:
|
|
|
|
|
_marker = None
|
|
|
|
|
response = conn.describe_cache_clusters(None, None, _marker, True)
|
|
|
|
|
_marker = response['DescribeCacheClustersResponse']['DescribeCacheClustersResult']['Marker']
|
|
|
|
|
try:
|
|
|
|
|
# Boto also doesn't provide wrapper classes to CacheClusters or
|
|
|
|
|
# CacheNodes. Because of that we can't make use of the get_list
|
|
|
|
|
# method in the AWSQueryConnection. Let's do the work manually
|
|
|
|
|
clusters = clusters + response['DescribeCacheClustersResponse']['DescribeCacheClustersResult']['CacheClusters']
|
|
|
|
|
except KeyError as e:
|
|
|
|
|
error = "ElastiCache query to AWS failed (unexpected format)."
|
|
|
|
|
self.fail_with_error(error, 'getting ElastiCache clusters')
|
|
|
|
|
except boto.exception.BotoServerError as e:
|
|
|
|
|
error = e.reason
|
|
|
|
|
|
|
|
|
@ -802,16 +815,6 @@ class Ec2Inventory(object):
|
|
|
|
|
error = "Looks like AWS ElastiCache is down:\n%s" % e.message
|
|
|
|
|
self.fail_with_error(error, 'getting ElastiCache clusters')
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Boto also doesn't provide wrapper classes to CacheClusters or
|
|
|
|
|
# CacheNodes. Because of that we can't make use of the get_list
|
|
|
|
|
# method in the AWSQueryConnection. Let's do the work manually
|
|
|
|
|
clusters = response['DescribeCacheClustersResponse']['DescribeCacheClustersResult']['CacheClusters']
|
|
|
|
|
|
|
|
|
|
except KeyError as e:
|
|
|
|
|
error = "ElastiCache query to AWS failed (unexpected format)."
|
|
|
|
|
self.fail_with_error(error, 'getting ElastiCache clusters')
|
|
|
|
|
|
|
|
|
|
for cluster in clusters:
|
|
|
|
|
self.add_elasticache_cluster(cluster, region)
|
|
|
|
|
|
|
|
|
|