show queue status for ns-op-list 01/9101/2 release-v8.0-start v8.0.0rc1 v8.0.0rc2
authortierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 17 Jun 2020 12:56:12 +0000 (12:56 +0000)
committerbeierlm <mark.beierl@canonical.com>
Wed, 17 Jun 2020 18:42:06 +0000 (20:42 +0200)
Change-Id: I659f78e3ffaff515c6b719ae9cdfcb8d44640fdc
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osmclient/scripts/osm.py

index f31d5f6..e3b5ac6 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")