From: garciadeblas Date: Fri, 16 Oct 2020 12:42:43 +0000 (+0000) Subject: Fix bug 1265: fix error in k8scluster-list with helm and juju opState X-Git-Tag: release-v9.0-start~6 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fosmclient.git;a=commitdiff_plain;h=b2b8260e191e7cb2f9059a705e2c030064ab4f16;hp=1c07734987fd56280f6f8a6198fa5823d6a6821a 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 --- diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 4867e49..9523965 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -3155,14 +3155,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