X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fscripts%2Fosm.py;h=26327fcb266189471f9f7bf0b71feed7fd733a8d;hb=refs%2Fchanges%2F42%2F8342%2F1;hp=d66bcfe21e87b2b3d2f58f13b2b4894cb6b0cc81;hpb=e79f0cafb1e4f8b065708187c6dd0f58b56a2aeb;p=osm%2Fosmclient.git diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index d66bcfe..26327fc 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -28,6 +28,7 @@ import time import pycurl import os import textwrap +import pkg_resources def wrap_text(text, width): @@ -2454,11 +2455,11 @@ def k8scluster_list(ctx, filter, literal): if literal: print(yaml.safe_dump(resp)) return - table = PrettyTable(['Name', 'Id', 'Version', 'VIM', 'K8s-nets', 'Description']) + table = PrettyTable(['Name', 'Id', 'Version', 'VIM', 'K8s-nets', 'Operational State', 'Description']) for cluster in resp: table.add_row([cluster['name'], cluster['_id'], cluster['k8s_version'], cluster['vim_account'], - json.dumps(cluster['nets']), trunc_text(cluster.get('description',''),40) - ]) + json.dumps(cluster['nets']), cluster["_admin"]["operationalState"], + trunc_text(cluster.get('description',''),40)]) table.align = 'l' print(table) except ClientException as e: @@ -2500,9 +2501,9 @@ def k8scluster_show(ctx, name, literal): @click.argument('name') @click.argument('uri') @click.option('--type', - type=click.Choice(['chart', 'bundle']), + type=click.Choice(['helm-chart', 'juju-bundle']), prompt=True, - help='type of repo (chart for helm-charts, bundle for juju-bundles)') + help='type of repo (helm-chart for Helm Charts, juju-bundle for Juju Bundles)') @click.option('--description', default='', help='human readable description') @@ -2538,8 +2539,8 @@ def repo_add(ctx, @click.argument('name') @click.option('--newname', help='New name for the repo') @click.option('--uri', help='URI of the repo') -@click.option('--type', type=click.Choice(['chart', 'bundle']), - help='type of repo (chart for helm-charts, bundle for juju-bundles)') +@click.option('--type', type=click.Choice(['helm-chart', 'juju-bundle']), + help='type of repo (helm-chart for Helm Charts, juju-bundle for Juju Bundles)') @click.option('--description', help='human readable description') #@click.option('--wait', # is_flag=True, @@ -3018,6 +3019,17 @@ def ns_metric_export(ctx, ns, vnf, vdu, metric, interval): # Other operations #################### +@cli.command(name='version') +@click.pass_context +def get_version(ctx): + try: + check_client_version(ctx.obj, "version") + print ("Server version: {}".format(ctx.obj.get_version())) + print ("Client version: {}".format(pkg_resources.get_distribution("osmclient").version)) + except ClientException as e: + print(str(e)) + exit(1) + @cli.command(name='upload-package', short_help='uploads a VNF package or NS package') @click.argument('filename') @click.pass_context