Check node length to match expected node count

This commit is contained in:
Clint Shryock 2015-05-29 10:09:54 -05:00
parent 8a4cbcb5a2
commit c95557af27
1 changed files with 5 additions and 0 deletions

View File

@ -337,6 +337,11 @@ func CacheClusterStateRefreshFunc(conn *elasticache.ElastiCache, clusterID, give
// return given state if it's not in pending // return given state if it's not in pending
if givenState != "" { if givenState != "" {
// check to make sure we have the node count we're expecting
if int64(len(c.CacheNodes)) != *c.NumCacheNodes {
log.Printf("[DEBUG] Node count is not what is expected: %d found, %d expected", len(c.CacheNodes), *c.NumCacheNodes)
return nil, "creating", nil
}
// loop the nodes and check their status as well // loop the nodes and check their status as well
for _, n := range c.CacheNodes { for _, n := range c.CacheNodes {
if n.CacheNodeStatus != nil && *n.CacheNodeStatus != "available" { if n.CacheNodeStatus != nil && *n.CacheNodeStatus != "available" {