diff --git a/VERSION b/VERSION index 063614d5..8f6e30ac 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.0-develop40 +1.18.0-develop41 diff --git a/modules/builder.py b/modules/builder.py index db13b38f..b5b622d8 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -196,14 +196,25 @@ class CollectionBuilder: logger.info(extra) logger.info("") - logger.separator(f"Building Definition From Templates", space=False, border=False) - if f"{self.type}_name" in methods: logger.warning(f"Config Warning: Running {self.type}_name as name") self.data["name"] = self.data[methods[f"{self.type}_name"]] methods["name"] = "name" if "template" in methods: + logger.separator(f"Building Definition From Templates", space=False, border=False) + logger.debug("") + named_templates = [] + for original_variables in util.get_list(self.data[methods["template"]], split=False): + if not isinstance(original_variables, dict): + raise Failed(f"{self.Type} Error: template attribute is not a dictionary") + elif "name" not in original_variables: + raise Failed(f"{self.Type} Error: template sub-attribute name is required") + elif not original_variables["name"]: + raise Failed(f"{self.Type} Error: template sub-attribute name cannot be blank") + named_templates.append(original_variables["name"]) + logger.debug(f"Templates Called: {','.join(named_templates)}") + logger.debug("") new_variables = {} if "variables" in methods: logger.debug("") @@ -212,7 +223,6 @@ class CollectionBuilder: raise Failed(f"{self.Type} Error: variables must be a dictionary (key: value pairs)") logger.trace(self.data[methods["variables"]]) new_variables = self.data[methods["variables"]] - logger.debug("") name = self.data[methods["name"]] if "name" in methods else None new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]], new_variables) for attr in new_attributes: diff --git a/modules/meta.py b/modules/meta.py index ad602bc7..2e29d297 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -196,18 +196,12 @@ class DataFile: else: new_attributes = {} for original_variables in util.get_list(template_call, split=False): - if not isinstance(original_variables, dict): - raise Failed(f"{self.data_type} Error: template attribute is not a dictionary") - elif "name" not in original_variables: - raise Failed(f"{self.data_type} Error: template sub-attribute name is required") - elif not original_variables["name"]: - raise Failed(f"{self.data_type} Error: template sub-attribute name is blank") - elif original_variables["name"] not in self.templates: + if original_variables["name"] not in self.templates: raise Failed(f"{self.data_type} Error: template {original_variables['name']} not found") elif not isinstance(self.templates[original_variables["name"]][0], dict): raise Failed(f"{self.data_type} Error: template {original_variables['name']} is not a dictionary") else: - logger.separator(f"Template {original_variables['name']}", space=False, border=False, debug=True) + logger.separator(f"Template {original_variables['name']}", space=False, border=False, trace=True) logger.trace("") logger.trace(f"Original: {original_variables}") @@ -470,7 +464,7 @@ class DataFile: logger.trace(f"Optional: {optional}") logger.trace("") logger.trace(f"Translation: {translation_variables}") - logger.debug("") + logger.trace("") def check_for_var(_method, _data): def scan_text(og_txt, var, actual_value): @@ -531,7 +525,6 @@ class DataFile: new_attributes[new_name] = check_data(new_name, attr_data) except Failed: continue - logger.debug("") logger.separator(f"Final Template Attributes", space=False, border=False, debug=True) logger.debug("") logger.debug(new_attributes)