Update rds module for RDS2 parameter name change.

boto's rds2 renamed `vpc_security_groups` to `vpc_security_group_ids`
and changed from a list of `VPCSecurityGroupMembership` to just a
list of ids. This accommodates that change when rds2 is being used.
This commit is contained in:
Jesse Rusak 2015-03-30 15:43:14 -04:00 committed by Matt Clay
parent 67f769d9a6
commit 9d93f052c2

10
lib/ansible/modules/cloud/amazon/rds.py Normal file → Executable file
View file

@ -931,11 +931,15 @@ def validate_parameters(required_vars, valid_vars, module):
if module.params.get('security_groups'): if module.params.get('security_groups'):
params[sec_group] = module.params.get('security_groups').split(',') params[sec_group] = module.params.get('security_groups').split(',')
if module.params.get('vpc_security_groups'): vpc_groups = module.params.get('vpc_security_groups')
if vpc_groups:
if has_rds2:
params['vpc_security_group_ids'] = vpc_groups
else:
groups_list = [] groups_list = []
for x in module.params.get('vpc_security_groups'): for x in vpc_groups:
groups_list.append(boto.rds.VPCSecurityGroupMembership(vpc_group=x)) groups_list.append(boto.rds.VPCSecurityGroupMembership(vpc_group=x))
params["vpc_security_groups"] = groups_list params['vpc_security_groups'] = groups_list
# Convert tags dict to list of tuples that rds2 expects # Convert tags dict to list of tuples that rds2 expects
if 'tags' in params: if 'tags' in params: