Fix GitOpsLcm.update_operation_history when workflow and resource status is None
Change-Id: I62830c5164c9e1838f36bc6c227036ec838cb736
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py
index ab6001b..3d974fc 100644
--- a/osm_lcm/k8s.py
+++ b/osm_lcm/k8s.py
@@ -101,22 +101,24 @@
self.logger.debug("Operations: {}".format(operation))
if operation["op_id"] == op_id:
self.logger.debug("Found operation number: {}".format(op_num))
- if workflow_status:
- operation["workflowState"] = "COMPLETED"
- operation["result"] = True
- else:
- operation["workflowState"] = "ERROR"
- operation["operationState"] = "FAILED"
- operation["result"] = False
+ if workflow_status is not None:
+ if workflow_status:
+ operation["workflowState"] = "COMPLETED"
+ operation["result"] = True
+ else:
+ operation["workflowState"] = "ERROR"
+ operation["operationState"] = "FAILED"
+ operation["result"] = False
- if resource_status:
- operation["resourceState"] = "READY"
- operation["operationState"] = "COMPLETED"
- operation["result"] = True
- else:
- operation["resourceState"] = "NOT_READY"
- operation["operationState"] = "FAILED"
- operation["result"] = False
+ if resource_status is not None:
+ if resource_status:
+ operation["resourceState"] = "READY"
+ operation["operationState"] = "COMPLETED"
+ operation["result"] = True
+ else:
+ operation["resourceState"] = "NOT_READY"
+ operation["operationState"] = "FAILED"
+ operation["result"] = False
if op_end:
now = time()