From: Igor D.C Date: Thu, 24 Sep 2020 22:01:35 +0000 (+0000) Subject: If getAppContextStatus fails, cancel waitForDone X-Git-Tag: 0.7.0~28 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=6498e883dcbc005b32f86f8a57c96950c359d98e;p=multicloud%2Fk8s.git If getAppContextStatus fails, cancel waitForDone And log error appropriately. Essentially, add basic error handling and return from waitForDone. It is possible to trigger this error easily by having an rsync client wipe out etcd right after issuing an InvokeUninstallApp, as demonstrated by DCM (before it was adapted to use the new asynchronous rsync). Issue-ID: MULTICLOUD-1143 Change-Id: Id5c0d8da928738cb3cdc862eaefdb91db2eadf5f Signed-off-by: Igor D.C --- diff --git a/src/rsync/pkg/context/context.go b/src/rsync/pkg/context/context.go index 4b886ec7..35e6c4e2 100644 --- a/src/rsync/pkg/context/context.go +++ b/src/rsync/pkg/context/context.go @@ -536,7 +536,13 @@ func waitForDone(ac appcontext.AppContext) { logutils.Info("Wait for done watcher running..", logutils.Fields{}) count = 0 } - acStatus, _ := getAppContextStatus(ac) + acStatus, err := getAppContextStatus(ac) + if err != nil { + logutils.Error("Failed to get the app context status", logutils.Fields{ + "error": err, + }) + return + } if acStatus.Status == appcontext.AppContextStatusEnum.Instantiated || acStatus.Status == appcontext.AppContextStatusEnum.InstantiateFailed { return