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 <shardy@redhat.com>
This commit is contained in:
Steven Hardy 2012-07-30 18:53:23 +01:00
parent 8f0caacf8a
commit 2779760de5
1 changed files with 3 additions and 2 deletions

View File

@ -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: