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