X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fscripts%2Fosm.py;h=71506cdc294a6c21837b105dbe5710cdf51764e2;hb=refs%2Fchanges%2F40%2F9740%2F4;hp=0ff195f76836770e54aa2a8157711b675e3e45e9;hpb=f8de2ec6434a4d30b9ec4f88e62e931150c7d324;p=osm%2Fosmclient.git diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 0ff195f..71506cd 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -3129,8 +3129,9 @@ def k8scluster_delete(ctx, name, force): help='restricts the list to the K8s clusters matching the filter') @click.option('--literal', is_flag=True, help='print literally, no pretty table') +@click.option('--long', is_flag=True, help='get more details') @click.pass_context -def k8scluster_list(ctx, filter, literal): +def k8scluster_list(ctx, filter, literal, long): """list all K8s clusters""" # try: check_client_version(ctx.obj, ctx.command.name) @@ -3140,11 +3141,23 @@ def k8scluster_list(ctx, filter, literal): if literal: print(yaml.safe_dump(resp, indent=4, default_flow_style=False)) return - table = PrettyTable(['Name', 'Id', 'Version', 'VIM', 'K8s-nets', 'Operational State', 'Description']) + if long: + table = PrettyTable(['Name', 'Id', 'Version', 'VIM', 'K8s-nets', 'Operational State', 'Op. state (details)', + 'Description', 'Detailed status']) + else: + table = PrettyTable(['Name', 'Id', 'VIM', 'Operational State', 'Op. state details']) for cluster in resp: - table.add_row([cluster['name'], cluster['_id'], cluster['k8s_version'], cluster['vim_account'], - json.dumps(cluster['nets']), cluster["_admin"]["operationalState"], - trunc_text(cluster.get('description') or '', 40)]) + op_state_details = "Helm: {}\nJuju: {}".format( + cluster["_admin"].get("helm-chart", "-").get("operationalState", "-"), + cluster["_admin"].get("juju-bundle", "-").get("operationalState", "-")) + if long: + detailed_status = cluster["_admin"].get("detailedStatus","-") + table.add_row([cluster['name'], cluster['_id'], cluster['k8s_version'], cluster['vim_account'], + json.dumps(cluster['nets']), cluster["_admin"]["operationalState"], + op_state_details, trunc_text(cluster.get('description') or '', 40), detailed_status]) + else: + table.add_row([cluster['name'], cluster['_id'], cluster['vim_account'], + cluster["_admin"]["operationalState"], op_state_details]) table.align = 'l' print(table) # except ClientException as e: