elasticache: default zone to None - fixes #31779 (#31785)

* elasticache: default zone to None.

* Only add PreferredAvailabilityZone to kwargs if self.zone is not None
This commit is contained in:
Sloane Hertel 2018-01-30 16:12:22 -05:00 committed by ansibot
parent c02b1f586f
commit fda09a75d3

View file

@ -218,10 +218,11 @@ class ElastiCacheManager(object):
CacheSecurityGroupNames=self.cache_security_groups, CacheSecurityGroupNames=self.cache_security_groups,
SecurityGroupIds=self.security_group_ids, SecurityGroupIds=self.security_group_ids,
CacheParameterGroupName=self.cache_parameter_group, CacheParameterGroupName=self.cache_parameter_group,
CacheSubnetGroupName=self.cache_subnet_group, CacheSubnetGroupName=self.cache_subnet_group)
PreferredAvailabilityZone=self.zone)
if self.cache_port is not None: if self.cache_port is not None:
kwargs['Port'] = self.cache_port kwargs['Port'] = self.cache_port
if self.zone is not None:
kwargs['PreferredAvailabilityZone'] = self.zone
try: try:
self.conn.create_cache_cluster(**kwargs) self.conn.create_cache_cluster(**kwargs)
@ -497,7 +498,7 @@ def main():
cache_subnet_group=dict(default=""), cache_subnet_group=dict(default=""),
cache_security_groups=dict(default=[], type='list'), cache_security_groups=dict(default=[], type='list'),
security_group_ids=dict(default=[], type='list'), security_group_ids=dict(default=[], type='list'),
zone=dict(default=""), zone=dict(),
wait=dict(default=True, type='bool'), wait=dict(default=True, type='bool'),
hard_modify=dict(type='bool') hard_modify=dict(type='bool')
)) ))