From b1363edb9e054ff5a6478662f174a9076c6d4ec4 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Mon, 11 Mar 2024 17:11:52 +0100 Subject: [PATCH] Fix bug 2240 to get packages from id and _id Change-Id: Iad5de449b0dcb036749c7d1536a84aec203ec396 Signed-off-by: garciadeblas --- osmclient/cli_commands/nfpkg.py | 2 +- osmclient/sol005/vnfd.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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)) -- 2.25.1