From: garciadeblas Date: Thu, 3 Oct 2024 11:25:01 +0000 (+0200) Subject: Fix bug 2259 in OSM repo generation when there is no product-name X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F14615%2F1;p=osm%2Fosmclient.git Fix bug 2259 in OSM repo generation when there is no product-name Change-Id: Ibbe655e39fdc9ebe8bb3ae1fac047c4d5d783734 Signed-off-by: garciadeblas --- 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 (