projects
/
osm
/
osmclient.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bug 1045. Show error if any at ns-list when ns operation is PROCESSING
[osm/osmclient.git]
/
osmclient
/
scripts
/
osm.py
diff --git
a/osmclient/scripts/osm.py
b/osmclient/scripts/osm.py
index
80c5e41
..
e1dbb8e
100755
(executable)
--- 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"
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']
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':
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'])
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")
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')
@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,
@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
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
"""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:
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')
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)
# except ClientException as e:
# print(str(e))
# exit(1)