def validate(self): ''' Validates the template. ''' # TODO(sdake) Should return line number of invalid reference # Validate Parameter Groups parameter_groups = ParameterGroups(self.t) parameter_groups.validate() # Check duplicate names between parameters and resources dup_names = set(self.parameters.keys()) & set(self.keys()) if dup_names: logger.debug(_("Duplicate names %s") % dup_names) raise StackValidationFailed(message=_("Duplicate names %s") % dup_names) for res in self.dependencies: try: result = res.validate() except exception.Error as ex: logger.exception(ex) raise ex except Exception as ex: logger.exception(ex) raise StackValidationFailed( message=strutils.safe_decode(six.text_type(ex))) if result: raise StackValidationFailed(message=result)
def validate(self): ''' Validates the template. ''' # TODO(sdake) Should return line number of invalid reference # validate overall template (top-level structure) self.t.validate() # Validate parameters self.parameters.validate(context=self.context) # Validate Parameter Groups parameter_groups = ParameterGroups(self.t) parameter_groups.validate() # Check duplicate names between parameters and resources dup_names = set(self.parameters.keys()) & set(self.keys()) if dup_names: LOG.debug("Duplicate names %s" % dup_names) raise StackValidationFailed(message=_("Duplicate names %s") % dup_names) for res in self.dependencies: try: result = res.validate() except exception.HeatException as ex: LOG.info(ex) raise ex except Exception as ex: LOG.exception(ex) raise StackValidationFailed( message=encodeutils.safe_decode(six.text_type(ex))) 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' % six.text_type(ex) raise StackValidationFailed(message=reason)