Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
refresh db_instances tool
Browse files Browse the repository at this point in the history
	modified:   builders.py
	modified:   plugins/refresh.py
  • Loading branch information
russellballestrini committed May 15, 2017
1 parent 1b67530 commit ef4809b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions botoform/builders.py
Expand Up @@ -752,9 +752,15 @@ def finish_instance_roles(self, instance_role_cfg, instances=None):

def db_instances(self, db_instance_cfg):
"""Build RDS DB Instances."""
existing_rds_names = self.evpc.rds.get_related_db_ids()

for rds_name, db_cfg in db_instance_cfg.items():

if rds_name in existing_rds_names:
msg = 'skipping RDS db_instance: {} (it already exists)'
self.log.emit(msg.format(rds_name), 'debug')
continue

self.log.emit('creating {} RDS db_instance ...'.format(rds_name))

# make list of security group ids.
Expand Down
15 changes: 14 additions & 1 deletion botoform/plugins/refresh.py
Expand Up @@ -59,7 +59,7 @@ def instance_roles(args, evpc):

def load_balancers(args, evpc):
"""
Refresh elb Load_balancers.
Refresh ELB load_balancers.
:param args: The parsed arguments and flags from the CLI.
:param evpc: An instance of :meth:`botoform.enriched.vpc.EnrichedVPC`.
Expand All @@ -69,6 +69,18 @@ def load_balancers(args, evpc):
builder = get_builder_for_existing_vpc(evpc, args)
builder.load_balancers(builder.config.get('load_balancers', no_cfg))

def db_instances(args, evpc):
"""
Refresh RDS db_instances.
:param args: The parsed arguments and flags from the CLI.
:param evpc: An instance of :meth:`botoform.enriched.vpc.EnrichedVPC`.
:returns: None
"""
builder = get_builder_for_existing_vpc(evpc, args)
builder.db_instances(builder.config.get('db_instances', no_cfg))

def private_zone(args, evpc):
"""
Refresh private zone with new records / values.
Expand Down Expand Up @@ -135,6 +147,7 @@ def security_groups(args, evpc):
'instance_roles' : instance_roles,
'security_groups' : security_groups,
'load_balancers' : load_balancers,
'db_instances' : db_instances,
}

class Refresh(object):
Expand Down

0 comments on commit ef4809b

Please sign in to comment.