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: v8.0.3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=e7f962303a0cf16e8508774c28eabd2989d6429b;p=osm%2Fosmclient.git 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 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