From 599bc8bc1743238b51544918ab3c9a786f9bc506 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 3 Oct 2024 13:25:01 +0200 Subject: [PATCH] Fix bug 2259 in OSM repo generation when there is no product-name Change-Id: Ibbe655e39fdc9ebe8bb3ae1fac047c4d5d783734 Signed-off-by: garciadeblas --- osmclient/sol005/osmrepo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osmclient/sol005/osmrepo.py b/osmclient/sol005/osmrepo.py index add5c18..48f69ef 100644 --- a/osmclient/sol005/osmrepo.py +++ b/osmclient/sol005/osmrepo.py @@ -308,7 +308,7 @@ class OSMRepo(Repo): self._logger.error(msg) raise ValueError(msg) # Repo search is based on 'name' entry in index.yaml. It is mandatory then - fields["name"] = aux_dict.get("name", aux_dict["product-name"]) + fields["name"] = aux_dict.get("name", aux_dict.get("product-name")) fields["id"] = aux_dict.get("id") fields["description"] = aux_dict.get("description") fields["vendor"] = aux_dict.get("vendor") @@ -368,12 +368,15 @@ class OSMRepo(Repo): self._logger.debug(f"Descriptor data: {descriptor_data}") validation = validation_im() desc_type, descriptor_dict = validation.yaml_validation(descriptor_data) + self._logger.debug(f"Descriptor type: {desc_type}") + self._logger.debug(f"Descriptor dict: {descriptor_dict}") try: validation_im.pyangbind_validation(self, desc_type, descriptor_dict) except Exception as e: self._logger.error(e, exc_info=True) raise e descriptor_type_ref = list(descriptor_dict.keys())[0].lower() + self._logger.debug(f"Descriptor type ref: {descriptor_type_ref}") if "vnf" in descriptor_type_ref: package_type = "vnf" elif "nst" in descriptor_type_ref: @@ -385,6 +388,8 @@ class OSMRepo(Repo): self._logger.error(msg) raise ValueError(msg) self._logger.debug("Descriptor: {}".format(descriptor_dict)) + self._logger.debug("Path: {}".format(path)) + self._logger.debug("Package type: {}".format(package_type)) fields = self.fields_building(descriptor_dict, path, package_type) self._logger.debug(f"Descriptor successfully validated {fields}") return ( -- 2.25.1