X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osmclient%2Fscripts%2Fosm.py;h=e1dbb8e54f82c576fa4851be20269dde00e68e9d;hb=5d41362313f63d22266adb647a79a43eb993e8eb;hp=80c5e41201296edf90c38b3f917a06fb9ea4c844;hpb=bcd12ffa6508cdef33058feeb03b34d216608498;p=osm%2Fosmclient.git diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 80c5e41..e1dbb8e 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -359,8 +359,8 @@ def ns_list(ctx, filter, long): vim = vim_name current_operation = "{} ({})".format(nsr['currentOperation'],nsr['currentOperationID']) error_details = "N/A" - if ns_state == "BROKEN" or ns_state == "DEGRADED": - error_details = "{}\nDetail: {}".format(nsr['errorDescription'],nsr['errorDetail']) + if ns_state == "BROKEN" or ns_state == "DEGRADED" or nsr['errorDescription']: + error_details = "{}\nDetail: {}".format(nsr['errorDescription'], nsr['errorDetail']) else: nsopdata = ctx.obj.ns.get_opdata(ns['id']) nsr = nsopdata['nsr:nsr'] @@ -711,12 +711,12 @@ def ns_op_list(ctx, name, long): action_name = op['operationParams']['primitive'] detail = "-" if op['operationState']=='PROCESSING': - if op['lcmOperationType']=='instantiate': + if op['lcmOperationType'] in ('instantiate', 'terminate'): if op['stage']: detail = op['stage'] else: detail = "In queue. Current position: {}".format(op['queuePosition']) - elif op['operationState']=='FAILED' or op['operationState']=='FAILED_TEMP': + elif op['operationState'] in ('FAILED', 'FAILED_TEMP'): detail = op.get('errorMessage','-') date = datetime.fromtimestamp(op['startTime']).strftime("%Y-%m-%dT%H:%M:%S") last_update = datetime.fromtimestamp(op['statusEnteredTime']).strftime("%Y-%m-%dT%H:%M:%S") @@ -1971,6 +1971,9 @@ def nfpkg_delete(ctx, name, force): @cli_osm.command(name='ns-delete', short_help='deletes a NS instance') @click.argument('name') @click.option('--force', is_flag=True, help='forces the deletion bypassing pre-conditions') +@click.option('--config', default=None, + help="specific yaml configuration for the termination, e.g. '{autoremove: False, timeout_ns_terminate: " + "600, skip_terminate_primitives: True}'") @click.option('--wait', required=False, default=False, @@ -1978,7 +1981,7 @@ def nfpkg_delete(ctx, name, force): help='do not return the control immediately, but keep it ' 'until the operation is completed, or timeout') @click.pass_context -def ns_delete(ctx, name, force, wait): +def ns_delete(ctx, name, force, config, wait): """deletes a NS instance NAME: name or ID of the NS instance to be deleted @@ -1986,10 +1989,10 @@ def ns_delete(ctx, name, force, wait): logger.debug("") # try: if not force: - ctx.obj.ns.delete(name, wait=wait) + ctx.obj.ns.delete(name, config=config, wait=wait) else: check_client_version(ctx.obj, '--force') - ctx.obj.ns.delete(name, force, wait=wait) + ctx.obj.ns.delete(name, force, config=config, wait=wait) # except ClientException as e: # print(str(e)) # exit(1)