Fix bug 2259 in OSM repo generation when there is no product-name 15/14615/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 3 Oct 2024 11:25:01 +0000 (13:25 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 3 Oct 2024 11:31:14 +0000 (13:31 +0200)
Change-Id: Ibbe655e39fdc9ebe8bb3ae1fac047c4d5d783734
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/sol005/osmrepo.py

index add5c18..48f69ef 100644 (file)
@@ -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 (