Fix GitOpsLcm.update_operation_history when workflow and resource status is None 54/14854/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 20 Dec 2024 09:37:12 +0000 (10:37 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 20 Dec 2024 09:37:21 +0000 (10:37 +0100)
Change-Id: I62830c5164c9e1838f36bc6c227036ec838cb736
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/k8s.py

index ab6001b..3d974fc 100644 (file)
@@ -101,22 +101,24 @@ class GitOpsLcm(LcmBase):
             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 resource_status:
-                    operation["resourceState"] = "READY"
-                    operation["operationState"] = "COMPLETED"
-                    operation["result"] = True
-                else:
-                    operation["resourceState"] = "NOT_READY"
-                    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 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()