aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/state/state_helper.go
diff options
context:
space:
mode:
authorManjunath Ranganathaiah <manjunath.ranganathaiah@intel.com>2020-08-07 19:06:22 +0000
committerEric Multanen <eric.w.multanen@intel.com>2020-09-09 21:42:13 -0700
commit6452065eb2d3b2f0926d16499e0ecedec2382422 (patch)
treea7c24154981f39eb07e8b4f8dfee0d2bc1fdd560 /src/orchestrator/pkg/state/state_helper.go
parentd14246bb9a2c8874f9925c45322d678a93584adb (diff)
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 <manjunath.ranganathaiah@intel.com> Change-Id: I2ed76efd9d8b6f40fec547bbe8b7d8a86f69ce07
Diffstat (limited to 'src/orchestrator/pkg/state/state_helper.go')
-rw-r--r--src/orchestrator/pkg/state/state_helper.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/orchestrator/pkg/state/state_helper.go b/src/orchestrator/pkg/state/state_helper.go
index 9d59fb75..1f926f8f 100644
--- a/src/orchestrator/pkg/state/state_helper.go
+++ b/src/orchestrator/pkg/state/state_helper.go
@@ -17,6 +17,8 @@
package state
import (
+ "encoding/json"
+
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext"
pkgerrors "github.com/pkg/errors"
)
@@ -69,3 +71,30 @@ func GetContextIdsFromStateInfo(s StateInfo) []string {
return ids
}
+
+func GetAppContextStatus(ctxid string) (appcontext.AppContextStatus, error) {
+
+ ac, err := GetAppContextFromId(ctxid)
+ if err != nil {
+ return appcontext.AppContextStatus{}, err
+ }
+
+ h, err := ac.GetCompositeAppHandle()
+ if err != nil {
+ return appcontext.AppContextStatus{}, err
+ }
+ sh, err := ac.GetLevelHandle(h, "status")
+ if err != nil {
+ return appcontext.AppContextStatus{}, err
+ }
+ s, err := ac.GetValue(sh)
+ if err != nil {
+ return appcontext.AppContextStatus{}, err
+ }
+ acStatus := appcontext.AppContextStatus{}
+ js, _ := json.Marshal(s)
+ json.Unmarshal(js, &acStatus)
+
+ return acStatus, nil
+
+}