From 8e32f54223b4b58890a31cffc95688a4d66cf398 Mon Sep 17 00:00:00 2001 From: Eugene Brevdo Date: Wed, 9 Apr 2014 13:32:47 -0700 Subject: [PATCH 1/2] VPC security group membership fix for boto. * facts now provides a list of existing vpc security group memberships * adding a comma separated list of sg-* tags properly modifies membership --- library/cloud/rds | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/cloud/rds b/library/cloud/rds index cde7c5bcf2..00a4e1a59f 100644 --- a/library/cloud/rds +++ b/library/cloud/rds @@ -465,7 +465,9 @@ def main(): params["security_groups"] = security_groups.split(',') if vpc_security_groups: - params["vpc_security_groups"] = vpc_security_groups.split(',') + params["vpc_security_groups"] = [ + boto.rds.VPCSecurityGroupMembership(vpc_group=x) if x else None + for x in vpc_security_groups.split(',')] if new_instance_name: params["new_instance_id"] = new_instance_name @@ -618,9 +620,14 @@ def main(): if resource.status == 'available' and command != 'snapshot': d["endpoint"] = resource.endpoint[0] d["port"] = resource.endpoint[1] + if resource.vpc_security_groups is not None: + d["vpc_security_groups"] = ','.join(x.vpc_group for x in resource.vpc_security_groups) + else: + d["vpc_security_groups"] = None else: d["endpoint"] = None d["port"] = None + d["vpc_security_groups"] = None # ReadReplicaSourceDBInstanceIdentifier may or may not exist try: From 3ac4943751ca06c1581f0b464d4e9ee020cfb993 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 8 May 2014 15:08:43 -0500 Subject: [PATCH 2/2] Some cleanup for the rds/vpc_security_groups fix --- library/cloud/rds | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/cloud/rds b/library/cloud/rds index 055ad17609..faef8480bb 100644 --- a/library/cloud/rds +++ b/library/cloud/rds @@ -300,7 +300,7 @@ def main(): multi_zone = dict(type='bool', default=False), iops = dict(required=False), security_groups = dict(required=False), - vpc_security_groups = dict(required=False), + vpc_security_groups = dict(type='list', required=False), port = dict(required=False), upgrade = dict(type='bool', default=False), option_group = dict(required=False), @@ -465,9 +465,10 @@ def main(): params["security_groups"] = security_groups.split(',') if vpc_security_groups: - params["vpc_security_groups"] = [ - boto.rds.VPCSecurityGroupMembership(vpc_group=x) if x else None - for x in vpc_security_groups.split(',')] + groups_list = [] + for x in vpc_security_groups: + groups_list.append(boto.rds.VPCSecurityGroupMembership(vpc_group=x)) + params["vpc_security_groups"] = groups_list if new_instance_name: params["new_instance_id"] = new_instance_name