fix aws elasticache idempotency
This commit is contained in:
parent
4b97cd3a42
commit
50622b4e6a
1 changed files with 10 additions and 12 deletions
|
@ -231,8 +231,8 @@ class ElastiCacheManager(object):
|
||||||
port=self.cache_port)
|
port=self.cache_port)
|
||||||
except boto.exception.BotoServerError, e:
|
except boto.exception.BotoServerError, e:
|
||||||
self.module.fail_json(msg=e.message)
|
self.module.fail_json(msg=e.message)
|
||||||
cache_cluster_data = response['CreateCacheClusterResponse']['CreateCacheClusterResult']['CacheCluster']
|
|
||||||
self._refresh_data(cache_cluster_data)
|
self._refresh_data()
|
||||||
|
|
||||||
self.changed = True
|
self.changed = True
|
||||||
if self.wait:
|
if self.wait:
|
||||||
|
@ -308,8 +308,7 @@ class ElastiCacheManager(object):
|
||||||
except boto.exception.BotoServerError, e:
|
except boto.exception.BotoServerError, e:
|
||||||
self.module.fail_json(msg=e.message)
|
self.module.fail_json(msg=e.message)
|
||||||
|
|
||||||
cache_cluster_data = response['ModifyCacheClusterResponse']['ModifyCacheClusterResult']['CacheCluster']
|
self._refresh_data()
|
||||||
self._refresh_data(cache_cluster_data)
|
|
||||||
|
|
||||||
self.changed = True
|
self.changed = True
|
||||||
if self.wait:
|
if self.wait:
|
||||||
|
@ -337,8 +336,7 @@ class ElastiCacheManager(object):
|
||||||
except boto.exception.BotoServerError, e:
|
except boto.exception.BotoServerError, e:
|
||||||
self.module.fail_json(msg=e.message)
|
self.module.fail_json(msg=e.message)
|
||||||
|
|
||||||
cache_cluster_data = response['RebootCacheClusterResponse']['RebootCacheClusterResult']['CacheCluster']
|
self._refresh_data()
|
||||||
self._refresh_data(cache_cluster_data)
|
|
||||||
|
|
||||||
self.changed = True
|
self.changed = True
|
||||||
if self.wait:
|
if self.wait:
|
||||||
|
@ -388,23 +386,23 @@ class ElastiCacheManager(object):
|
||||||
'EngineVersion': self.cache_engine_version
|
'EngineVersion': self.cache_engine_version
|
||||||
}
|
}
|
||||||
for key, value in modifiable_data.iteritems():
|
for key, value in modifiable_data.iteritems():
|
||||||
if self.data[key] != value:
|
if value is not None and self.data[key] != value:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Check cache security groups
|
# Check cache security groups
|
||||||
cache_security_groups = []
|
cache_security_groups = []
|
||||||
for sg in self.data['CacheSecurityGroups']:
|
for sg in self.data['CacheSecurityGroups']:
|
||||||
cache_security_groups.append(sg['CacheSecurityGroupName'])
|
cache_security_groups.append(sg['CacheSecurityGroupName'])
|
||||||
if set(cache_security_groups) - set(self.cache_security_groups):
|
if set(cache_security_groups) != set(self.cache_security_groups):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# check vpc security groups
|
# check vpc security groups
|
||||||
vpc_security_groups = []
|
vpc_security_groups = []
|
||||||
security_groups = self.data['SecurityGroups'] or []
|
security_groups = self.data['SecurityGroups'] or []
|
||||||
for sg in security_groups:
|
for sg in security_groups:
|
||||||
vpc_security_groups.append(sg['SecurityGroupId'])
|
vpc_security_groups.append(sg['SecurityGroupId'])
|
||||||
if set(vpc_security_groups) - set(self.security_group_ids):
|
if set(vpc_security_groups) != set(self.security_group_ids):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -421,7 +419,7 @@ class ElastiCacheManager(object):
|
||||||
if self.zone is not None:
|
if self.zone is not None:
|
||||||
unmodifiable_data['zone'] = self.data['PreferredAvailabilityZone']
|
unmodifiable_data['zone'] = self.data['PreferredAvailabilityZone']
|
||||||
for key, value in unmodifiable_data.iteritems():
|
for key, value in unmodifiable_data.iteritems():
|
||||||
if getattr(self, key) != value:
|
if getattr(self, key) is not None and getattr(self, key) != value:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue