From: garciadeblas Date: Fri, 20 Dec 2024 09:37:12 +0000 (+0100) Subject: Fix GitOpsLcm.update_operation_history when workflow and resource status is None X-Git-Tag: v17.0.0~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F14854%2F1;p=osm%2FLCM.git Fix GitOpsLcm.update_operation_history when workflow and resource status is None Change-Id: I62830c5164c9e1838f36bc6c227036ec838cb736 Signed-off-by: garciadeblas --- diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index ab6001b7..3d974fce 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -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()