Adding a deepcopy of the template before stack create validation

Calling stack.validate will modify the stack's template, which
we don't want to do.  We just want to validate the template and move
on with an already parsed template.
This commit is contained in:
Chris Alfonso 2012-05-10 15:02:46 -04:00
parent 74f9579f89
commit 3d5b05c50d
2 changed files with 12 additions and 2 deletions

View File

@ -124,6 +124,18 @@ class EngineManager(manager.Manager):
return {'Error': 'Stack already exists with that name.'}
metadata_server = config.FLAGS.heat_metadata_server_url
# We don't want to reset the stack template, so we are making
# an instance just for validation.
template_copy = deepcopy(template)
stack_validator = parser.Stack(stack_name, template_copy, 0, params,
metadata_server=metadata_server)
response = stack_validator.validate()
stack_validator = None
template_copy = None
if 'Malformed Query Response' in \
response['ValidateTemplateResult']['Description']:
return response['ValidateTemplateResult']['Description']
stack = parser.Stack(stack_name, template, 0, params,
metadata_server=metadata_server)
rt = {}

View File

@ -21,8 +21,6 @@ import os
import shutil
from heat.db.sqlalchemy.session import get_engine
import pdb
def reset_db():
if os.path.exists('heat-test.db'):