Commit bc80bd36 by Victor Schröder

Adds the necessary logic to ec2.py to load ElastiCache related configuration

parent 382c6fe0
...@@ -121,6 +121,7 @@ from time import time ...@@ -121,6 +121,7 @@ from time import time
import boto import boto
from boto import ec2 from boto import ec2
from boto import rds from boto import rds
from boto import elasticache
from boto import route53 from boto import route53
import six import six
...@@ -232,6 +233,11 @@ class Ec2Inventory(object): ...@@ -232,6 +233,11 @@ class Ec2Inventory(object):
if config.has_option('ec2', 'rds'): if config.has_option('ec2', 'rds'):
self.rds_enabled = config.getboolean('ec2', 'rds') self.rds_enabled = config.getboolean('ec2', 'rds')
# Include ElastiCache instances?
self.elasticache_enabled = True
if config.has_option('ec2', 'elasticache'):
self.elasticache_enabled = config.getboolean('ec2', 'elasticache')
# Return all EC2 and RDS instances (if RDS is enabled) # Return all EC2 and RDS instances (if RDS is enabled)
if config.has_option('ec2', 'all_instances'): if config.has_option('ec2', 'all_instances'):
self.all_instances = config.getboolean('ec2', 'all_instances') self.all_instances = config.getboolean('ec2', 'all_instances')
...@@ -242,6 +248,18 @@ class Ec2Inventory(object): ...@@ -242,6 +248,18 @@ class Ec2Inventory(object):
else: else:
self.all_rds_instances = False self.all_rds_instances = False
# Return all ElastiCache clusters? (if ElastiCache is enabled)
if config.has_option('ec2', 'all_elasticache_clusters') and self.elasticache_enabled:
self.all_elasticache_clusters = config.getboolean('ec2', 'all_elasticache_clusters')
else:
self.all_elasticache_clusters = False
# Return all ElastiCache nodes? (if ElastiCache is enabled)
if config.has_option('ec2', 'all_elasticache_nodes') and self.elasticache_enabled:
self.all_elasticache_nodes = config.getboolean('ec2', 'all_elasticache_nodes')
else:
self.all_elasticache_nodes = False
# Cache related # Cache related
cache_dir = os.path.expanduser(config.get('ec2', 'cache_path')) cache_dir = os.path.expanduser(config.get('ec2', 'cache_path'))
if not os.path.exists(cache_dir): if not os.path.exists(cache_dir):
...@@ -272,6 +290,9 @@ class Ec2Inventory(object): ...@@ -272,6 +290,9 @@ class Ec2Inventory(object):
'group_by_route53_names', 'group_by_route53_names',
'group_by_rds_engine', 'group_by_rds_engine',
'group_by_rds_parameter_group', 'group_by_rds_parameter_group',
'group_by_elasticache_engine',
'group_by_elasticache_cluster',
'group_by_elasticache_parameter_group',
] ]
for option in group_by_options: for option in group_by_options:
if config.has_option('ec2', option): if config.has_option('ec2', option):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment