def _translate_inputs(self): hot_inputs = [] hot_default = None for input in self.inputs: hot_input_type = TOSCA_TO_HOT_INPUT_TYPES[input.type] if input.name in self.parsed_params: DataEntity.validate_datatype(hot_input_type, self.parsed_params[input.name]) hot_default = self.parsed_params[input.name] elif input.default is not None: hot_default = input.default else: raise Exception(_("Need to specify a value " "for input {0}").format(input.name)) hot_constraints = [] if input.constraints: for constraint in input.constraints: constraint.validate( int(hot_default) if hot_input_type == "number" else hot_default) hc, hvalue = self._translate_constraints( constraint.constraint_key, constraint.constraint_value) hot_constraints.append({hc: hvalue}) hot_inputs.append(HotParameter(name=input.name, type=hot_input_type, description=input.description, default=hot_default, constraints=hot_constraints)) return hot_inputs
def _translate_inputs(self): hot_inputs = [] hot_default = None for input in self.inputs: hot_input_type = TOSCA_TO_HOT_INPUT_TYPES[input.type] if input.name in self.parsed_params: DataEntity.validate_datatype(hot_input_type, self.parsed_params[input.name]) hot_default = self.parsed_params[input.name] elif input.default is not None: hot_default = input.default else: raise Exception( _("Need to specify a value " "for input {0}").format(input.name)) hot_constraints = [] if input.constraints: for constraint in input.constraints: constraint.validate( int(hot_default) if hot_input_type == "number" else hot_default) hc, hvalue = self._translate_constraints( constraint.constraint_key, constraint.constraint_value) hot_constraints.append({hc: hvalue}) hot_inputs.append( HotParameter(name=input.name, type=hot_input_type, description=input.description, default=hot_default, constraints=hot_constraints)) return hot_inputs
def validate(self): '''Validate if not a reference property.''' if not is_function(self.value): if self.type == Schema.STRING: self.value = str(self.value) DataEntity.validate_datatype(self.type, self.value, self.entry_schema, self.custom_def) self._validate_constraints()
def validate(self): '''Validate if not a reference property.''' if not is_function(self.value): if self.type == Schema.STRING: self.value = str(self.value) DataEntity.validate_datatype(self.type, self.value, self.entry_schema, self.custom_def) self._validate_constraints()