def __init__(self, path=None, parsed_params=None, a_file=True, yaml_dict_tpl=None, sub_mapped_node_template=None, no_required_paras_check=False, debug_mode=False): if sub_mapped_node_template is None: ExceptionCollector.start() self.a_file = a_file self.input_path = None self.path = None self.tpl = None self.sub_mapped_node_template = sub_mapped_node_template self.nested_tosca_tpls_with_topology = {} self.nested_tosca_templates_with_topology = [] self.no_required_paras_check = no_required_paras_check self.debug_mode = debug_mode if path: self.input_path = path self.path = self._get_path(path) if self.path: self.tpl = YAML_LOADER(self.path, self.a_file) if yaml_dict_tpl: msg = (_('Both path and yaml_dict_tpl arguments were ' 'provided. Using path and ignoring yaml_dict_tpl.')) log.info(msg) print(msg) else: if yaml_dict_tpl: self.tpl = yaml_dict_tpl else: ExceptionCollector.appendException( ValueError( _('No path or yaml_dict_tpl was provided. ' 'There is nothing to parse.'))) if self.tpl: self.parsed_params = parsed_params self._validate_field() self.version = self._tpl_version() self.relationship_types = self._tpl_relationship_types() self.description = self._tpl_description() self.topology_template = self._topology_template() self.repositories = self._tpl_repositories() if self.topology_template.tpl: self.inputs = self._inputs() self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() self.policies = self._policies() self._handle_nested_tosca_templates_with_topology() self.graph = ToscaGraph(self.nodetemplates) if sub_mapped_node_template is None: ExceptionCollector.stop() self.verify_template()
def __init__(self, path=None, parsed_params=None, a_file=True, yaml_dict_tpl=None): ExceptionCollector.start() self.a_file = a_file self.input_path = None self.path = None self.tpl = None if path: self.input_path = path self.path = self._get_path(path) if self.path: self.tpl = YAML_LOADER(self.path, self.a_file) if yaml_dict_tpl: msg = (_('Both path and yaml_dict_tpl arguments were ' 'provided. Using path and ignoring yaml_dict_tpl.')) log.info(msg) print(msg) else: if yaml_dict_tpl: self.tpl = yaml_dict_tpl else: ExceptionCollector.appendException( ValueError( _('No path or yaml_dict_tpl was provided. ' 'There is nothing to parse.'))) if self.tpl: self.parsed_params = parsed_params self._validate_field() self.version = self._tpl_version() self.relationship_types = self._tpl_relationship_types() self.description = self._tpl_description() self.topology_template = self._topology_template() self.repositories = self._tpl_repositories() if self.topology_template.tpl: self.inputs = self._inputs() self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() self.graph = ToscaGraph(self.nodetemplates) ExceptionCollector.stop() self.verify_template()
def __init__(self, template, custom_defs, rel_types=None, parsed_params=None): self.tpl = template if self.tpl: self.custom_defs = custom_defs self.rel_types = rel_types self.parsed_params = parsed_params self._validate_field() self.description = self._tpl_description() self.inputs = self._inputs() self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() if hasattr(self, 'nodetemplates'): self.graph = ToscaGraph(self.nodetemplates) self.groups = self._groups() self._process_intrinsic_functions()
def __init__(self, path, parsed_params=None, a_file=True): ExceptionCollector.start() self.a_file = a_file self.input_path = path self.path = self._get_path(path) if self.path: self.tpl = YAML_LOADER(self.path, self.a_file) self.parsed_params = parsed_params self._validate_field() self.version = self._tpl_version() self.relationship_types = self._tpl_relationship_types() self.description = self._tpl_description() self.topology_template = self._topology_template() if self.topology_template.tpl: self.inputs = self._inputs() self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() self.graph = ToscaGraph(self.nodetemplates) ExceptionCollector.stop() self.verify_template()