From: garciadeblas Date: Mon, 11 Mar 2024 16:11:52 +0000 (+0100) Subject: Fix bug 2240 to get packages from id and _id X-Git-Tag: release-v16.0-start~16 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b1363edb9e054ff5a6478662f174a9076c6d4ec4;p=osm%2Fosmclient.git Fix bug 2240 to get packages from id and _id Change-Id: Iad5de449b0dcb036749c7d1536a84aec203ec396 Signed-off-by: garciadeblas --- diff --git a/osmclient/cli_commands/nfpkg.py b/osmclient/cli_commands/nfpkg.py index ce7212e..8d3f01b 100755 --- a/osmclient/cli_commands/nfpkg.py +++ b/osmclient/cli_commands/nfpkg.py @@ -71,7 +71,7 @@ def vnfd_list(ctx, nf_type, filter, long): else: table = PrettyTable(["nfpkg name", "id", "desc type"]) for vnfd in resp: - name = vnfd.get("id", vnfd.get("name", "-")) + name = vnfd.get("id", vnfd.get("product-name", "-")) descriptor_type = "sol006" if "product-name" in vnfd else "rel8" if long: onb_state = vnfd["_admin"].get("onboardingState", "-") diff --git a/osmclient/sol005/vnfd.py b/osmclient/sol005/vnfd.py index 3c09707..5c8b310 100644 --- a/osmclient/sol005/vnfd.py +++ b/osmclient/sol005/vnfd.py @@ -66,9 +66,9 @@ class Vnfd(object): return vnfd else: for vnfd in self.list(): - if "product-name" in vnfd and name == vnfd["product-name"]: + if "id" in vnfd and name == vnfd["id"]: return vnfd - elif "name" in vnfd and name == vnfd["name"]: + elif "product-name" in vnfd and name == vnfd["product-name"]: return vnfd raise NotFound("vnfd {} not found".format(name))