aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/state
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-09-10 00:05:47 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-10 00:05:47 +0000
commit798e8e087cbe91de4be96f290cf8a8073069fc2e (patch)
treeeb668ed60001a29cd2a23eca20cd616725d91b07 /src/orchestrator/pkg/state
parentbca6932e54ff0495947d8a4f1862339a69d386f8 (diff)
parent6452065eb2d3b2f0926d16499e0ecedec2382422 (diff)
Merge "Changes to add state and retry logic to rsync"
Diffstat (limited to 'src/orchestrator/pkg/state')
-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
+
+}