Validation functions for resources and outputs

This patch add ability to validate values in outputs section and also
validate properties in resource snippets.

Related-Bug: #1273490
Change-Id: I9ccb880954751555709bd92f2412cf5606969e70
This commit is contained in:
Sergey Kraynev
2014-03-24 06:21:40 -04:00
committed by Gerrit Code Review
parent 85e9411d3d
commit dfbaf72b27
2 changed files with 10 additions and 0 deletions

View File

@@ -364,6 +364,14 @@ class Stack(collections.Mapping):
if result:
raise StackValidationFailed(message=result)
for val in self.outputs.values():
snippet = val.get('Value', '')
try:
function.validate(snippet)
except Exception as ex:
reason = 'Output validation error: %s' % str(ex)
raise StackValidationFailed(message=reason)
def requires_deferred_auth(self):
'''
Returns whether this stack may need to perform API requests

View File

@@ -18,6 +18,7 @@ from datetime import datetime
from heat.engine import event
from heat.common import exception
from heat.engine import function
from heat.openstack.common import excutils
from heat.db import api as db_api
from heat.common import identifier
@@ -642,6 +643,7 @@ class Resource(object):
def validate(self):
logger.info(_('Validating %s') % str(self))
function.validate(self.t)
self.validate_deletion_policy(self.t)
return self.properties.validate()