From: Pedro Escaleira Date: Sun, 3 Apr 2022 12:51:46 +0000 (+0100) Subject: Bug 1965 fixed X-Git-Tag: v12.0.0rc1~30 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F11826%2F3;p=osm%2FN2VC.git Bug 1965 fixed Parsed the manifest returned by the `helm status` command (in the `_status_kdu` method) from a raw string to a list of dictionaries (each entry in the list corresponds to each manifest's document). Change-Id: I791c8fd59fee8ac67bcbd640a100bf63d572efcf Signed-off-by: Pedro Escaleira --- diff --git a/n2vc/k8s_helm3_conn.py b/n2vc/k8s_helm3_conn.py index 82a29a6..8bfd173 100644 --- a/n2vc/k8s_helm3_conn.py +++ b/n2vc/k8s_helm3_conn.py @@ -404,11 +404,18 @@ class K8sHelm3Connector(K8sHelmBaseConnector): # remove field 'notes' and manifest try: del data.get("info")["notes"] - del data["manifest"] except KeyError: pass - # unable to parse 'resources' as currently it is not included in helm3 + # parse the manifest to a list of dictionaries + if "manifest" in data: + manifest_str = data.get("manifest") + manifest_docs = yaml.load_all(manifest_str, Loader=yaml.SafeLoader) + + data["manifest"] = [] + for doc in manifest_docs: + data["manifest"].append(doc) + return data def _get_install_command( diff --git a/n2vc/k8s_helm_conn.py b/n2vc/k8s_helm_conn.py index b11ddd0..444f2da 100644 --- a/n2vc/k8s_helm_conn.py +++ b/n2vc/k8s_helm_conn.py @@ -500,6 +500,15 @@ class K8sHelmConnector(K8sHelmBaseConnector): except KeyError: pass + # parse the manifest to a list of dictionaries + if "manifest" in data: + manifest_str = data.get("manifest") + manifest_docs = yaml.load_all(manifest_str, Loader=yaml.SafeLoader) + + data["manifest"] = [] + for doc in manifest_docs: + data["manifest"].append(doc) + # parse field 'resources' try: resources = str(data.get("info").get("status").get("resources"))