From 392b8e2585079e268809f79f5aeb9429d500e1fe Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 16 Oct 2020 12:42:43 +0000 Subject: [PATCH] Fix bug 1265: fix error in k8scluster-list with helm and juju opState K8scluster-list was showing errors when getting helm-chart and juju-bundle operational state when keys were no present. Change-Id: Iaf1e9d7cc7137ec6ea33bb458a4759f150c8d5d2 Signed-off-by: garciadeblas --- osmclient/scripts/osm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 054bbd1..7b3bfeb 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -3163,14 +3163,14 @@ def k8scluster_list(ctx, filter, literal, long): except: vim_list = [] for cluster in resp: + logger.debug('Cluster details: {}'.format(yaml.safe_dump(cluster))) vim_name = get_vim_name(vim_list, cluster['vim_account']) #vim_info = '{} ({})'.format(vim_name,cluster['vim_account']) vim_info = vim_name op_state_details = "Helm: {}\nJuju: {}".format( - cluster["_admin"].get("helm-chart", "-").get("operationalState", "-"), - cluster["_admin"].get("juju-bundle", "-").get("operationalState", "-")) + cluster["_admin"].get("helm-chart", {}).get("operationalState", "-"), + cluster["_admin"].get("juju-bundle", {}).get("operationalState", "-")) if long: - logger.debug('Cluster details: {}'.format(yaml.safe_dump(cluster))) project_id, project_name = get_project(project_list, cluster) #project_info = '{} ({})'.format(project_name, project_id) project_info = project_name -- 2.25.1