'Validates the stack.'

@profiler.trace('Stack.validate', hide_args=False)
def validate(self, ignorable_errors=None, validate_res_tmpl_only=False):

    self.t.validate()
    self.parameters.validate(context=self.context, validate_value=self.strict_validate)
    parameter_groups = param_groups.ParameterGroups(self.t)
    parameter_groups.validate()
    if (type(self.t).validate_resource_definitions != tmpl.Template.validate_resource_definitions):
        warnings.warn('The    Template.validate_resource_definitions()    method    is    deprecated    and    will    no    longer    be    called    in    future    versions    of    Heat.    Template    subclasses    should    validate    resource    definitions    in    the    resource_definitions()    method.', DeprecationWarning)
    self.t.validate_resource_definitions(self)
    self.t.conditions(self).validate()
    resources = self.resources
    dup_names = (set(self.parameters) & set(resources))
    if dup_names:
        LOG.debug(('Duplicate    names    %s' % dup_names))
        raise exception.StackValidationFailed(message=(_('Duplicate    names    %s') % dup_names))
    self._update_all_resource_data(for_resources=True, for_outputs=True)
    if self.strict_validate:
        iter_rsc = self.dependencies
    else:
        iter_rsc = self._explicit_dependencies()
    unique_defns = set((res.t for res in six.itervalues(resources)))
    unique_defn_names = set((defn.name for defn in unique_defns))
    for res in iter_rsc:
        if (res.name not in unique_defn_names):
            continue
        result = None
        try:
            if (not validate_res_tmpl_only):
                if (res.external_id is not None):
                    res.validate_external()
                    continue
                result = res.validate()
            elif (res.external_id is None):
                result = res.validate_template()
        except exception.HeatException as ex:
            LOG.debug('%s', ex)
            if (ignorable_errors and (ex.error_code in ignorable_errors)):
                result = None
            else:
                raise
        except AssertionError:
            raise
        except Exception as ex:
            LOG.info('Exception    in    stack    validation', exc_info=True)
            raise exception.StackValidationFailed(error=ex, resource=res)
        if result:
            raise exception.StackValidationFailed(message=result)
        eventlet.sleep(0)
    for (op_name, output) in six.iteritems(self.outputs):
        try:
            path = '.'.join([self.t.OUTPUTS, op_name, self.t.OUTPUT_VALUE])
            output.validate(path)
        except exception.StackValidationFailed:
            raise
        except AssertionError:
            raise
