From 6452065eb2d3b2f0926d16499e0ecedec2382422 Mon Sep 17 00:00:00 2001 From: Manjunath Ranganathaiah Date: Fri, 7 Aug 2020 19:06:22 +0000 Subject: Changes to add state and retry logic to rsync - Adds retry watcher and related functionality. - Adds code to update, get the status from appcontext. - Adds logic to handle state transition during terminate. Issue-ID: MULTICLOUD-1005 Signed-off-by: Manjunath Ranganathaiah Change-Id: I2ed76efd9d8b6f40fec547bbe8b7d8a86f69ce07 --- src/orchestrator/pkg/module/deployment_intent_groups.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/orchestrator/pkg/module/deployment_intent_groups.go') diff --git a/src/orchestrator/pkg/module/deployment_intent_groups.go b/src/orchestrator/pkg/module/deployment_intent_groups.go index f9829853..dec6391f 100644 --- a/src/orchestrator/pkg/module/deployment_intent_groups.go +++ b/src/orchestrator/pkg/module/deployment_intent_groups.go @@ -21,6 +21,7 @@ import ( "reflect" "time" + "github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext" "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db" "github.com/onap/multicloud-k8s/src/orchestrator/pkg/state" @@ -271,6 +272,14 @@ func (c *DeploymentIntentGroupClient) DeleteDeploymentIntentGroup(di string, p s // remove the app contexts associated with thie Deployment Intent Group if stateVal == state.StateEnum.Terminated { + // Verify that the appcontext has completed terminating + ctxid := state.GetLastContextIdFromStateInfo(s) + acStatus, err := state.GetAppContextStatus(ctxid) + if err == nil && + !(acStatus.Status == appcontext.AppContextStatusEnum.Terminated || acStatus.Status == appcontext.AppContextStatusEnum.TerminateFailed) { + return pkgerrors.Errorf("DeploymentIntentGroup has not completed terminating: " + di) + } + for _, id := range state.GetContextIdsFromStateInfo(s) { context, err := state.GetAppContextFromId(id) if err != nil { -- cgit 1.2.3-korg