From: Steven Hardy Date: Mon, 30 Jul 2012 17:53:23 +0000 (+0100) Subject: heat engine : Avoid writing to class-scope parameters schema X-Git-Tag: 2014.1~1554 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2779760de5d47d7368e541a5a631b041ca4eda1b;p=openstack-build%2Fheat-build.git heat engine : Avoid writing to class-scope parameters schema Fixes issue where multiple instances of the same resource types which have different parameters break, because the parser is writing back to the class-scope properties_schema which should be immutable. This patch fixes by making a per-instance copy. Fixes #183 Change-Id: Ia29f67465acbcfaf8dfe511ddaa9075bc48157ad Signed-off-by: Steven Hardy --- diff --git a/heat/engine/checkeddict.py b/heat/engine/checkeddict.py index 90a04174..daef6586 100644 --- a/heat/engine/checkeddict.py +++ b/heat/engine/checkeddict.py @@ -15,6 +15,7 @@ import collections import re +from copy import deepcopy from heat.openstack.common import log as logging @@ -28,7 +29,7 @@ class CheckedDict(collections.MutableMapping): self.name = name def addschema(self, key, schema): - self.data[key] = schema + self.data[key] = deepcopy(schema) def get_attr(self, key, attr): return self.data[key].get(attr, '') @@ -156,7 +157,7 @@ class CheckedDict(collections.MutableMapping): class Properties(CheckedDict): def __init__(self, name, schema): CheckedDict.__init__(self, name) - self.data = schema + self.data = deepcopy(schema) # set some defaults for s in self.data: