Skip the in-built dependencies while validating template

There are many neutron and nova resource has in-built
dependencies by using add_dependencies() method. Its not
required to validate them while valding the user template,
as
1. user interest will be validaing their template
2. in-built dependencies are not known to user.

Co-Authored-By: Rabi Mishra <ramishra@redhat.com>
Change-Id: I4a3043fd17b69a346d447dfbd17488040cf9b387
Related-bug: #1554380
This commit is contained in:
Kanagaraj Manickam 2016-03-10 19:18:42 +05:30
parent 0bf9463bfc
commit d12cbe7959
2 changed files with 9 additions and 3 deletions

View File

@ -1177,7 +1177,8 @@ class EngineService(service.Service):
resource_validate=False,
service_check_defer=service_check_defer)
try:
stack.validate(ignorable_errors=ignorable_errors)
stack.validate(ignorable_errors=ignorable_errors,
validate_by_deps=False)
except exception.StackValidationFailed as ex:
return {'Error': six.text_type(ex)}

View File

@ -710,7 +710,7 @@ class Stack(collections.Mapping):
return handler and handler(resource_name)
@profiler.trace('Stack.validate', hide_args=False)
def validate(self, ignorable_errors=None):
def validate(self, ignorable_errors=None, validate_by_deps=True):
"""Validates the stack."""
# TODO(sdake) Should return line number of invalid reference
@ -737,7 +737,12 @@ class Stack(collections.Mapping):
raise exception.StackValidationFailed(
message=_("Duplicate names %s") % dup_names)
for res in self.dependencies:
if validate_by_deps:
iter_rsc = self.dependencies
else:
iter_rsc = six.itervalues(self.resources)
for res in iter_rsc:
try:
if self.resource_validate:
result = res.validate()