Autoscaling: compare fully-resolved templates

The Resource.t snippet is a parsed but unresolved template snippet. In
practice there should be no intrinsic functions included to resolve at the
moment, but in principle we should do comparisons on the fully-resolved
result.

Change-Id: I12d2e7c8282ddfbb7cca4930ef557ce3856a88b5
This commit is contained in:
Zane Bitter 2014-05-02 21:43:17 -04:00
parent a0df9425cf
commit a94239a107
1 changed files with 3 additions and 2 deletions

View File

@ -12,7 +12,6 @@
# under the License.
import copy
import functools
import json
import math
@ -319,11 +318,13 @@ class InstanceGroup(stack_resource.StackResource):
Replace the instances in the group using updated launch configuration
"""
def changing_instances(tmpl):
def serialize_template(t):
return json.dumps(function.resolve(t), sort_keys=True)
instances = self.get_instances()
# To support both HOT and CFN, need to find out what the name of
# the resources key is.
resources_key = self.nested().t.RESOURCES
serialize_template = functools.partial(json.dumps, sort_keys=True)
current = set((i.name, serialize_template(i.t)) for i in instances)
updated = set((k, serialize_template(v))
for k, v in tmpl[resources_key].items())