Fix bug 1159: vdu can be empty in a KNF, override option must take it into account
[osm/osmclient.git] / osmclient / scripts / osm.py
index f31d5f6..af20edf 100755 (executable)
@@ -787,12 +787,12 @@ def ns_op_list(ctx, name, long):
         if op['lcmOperationType']=='action':
             action_name = op['operationParams']['primitive']
         detail = "-"
-        if op['operationState']=='PROCESSING':
-            if op['lcmOperationType'] in ('instantiate', 'terminate'):
+        if op['operationState'] == 'PROCESSING':
+            if op['queuePosition'] is not None and op['queuePosition'] > 0:
+                detail = "In queue. Current position: {}".format(op['queuePosition'])
+            elif op['lcmOperationType'] in ('instantiate', 'terminate'):
                 if op['stage']:
                     detail = op['stage']
-            else:
-                detail = "In queue. Current position: {}".format(op['queuePosition'])
         elif op['operationState'] in ('FAILED', 'FAILED_TEMP'):
             detail = op.get('errorMessage','-')
         date = datetime.fromtimestamp(op['startTime']).strftime("%Y-%m-%dT%H:%M:%S")
@@ -1306,6 +1306,7 @@ def vnf_show(ctx, name, literal, filter, kdu):
             time.sleep(5)
             t += 5
         print ("Could not determine KDU status")
+        return
 
     if literal:
         print(yaml.safe_dump(resp, indent=4, default_flow_style=False))