summaryrefslogtreecommitdiffstats
path: root/src/rsync/pkg/grpc
diff options
context:
space:
mode:
authorManjunath Ranganathaiah <manjunath.ranganathaiah@intel.com>2020-06-19 17:54:58 +0000
committerManjunath Ranganathaiah <manjunath.ranganathaiah@intel.com>2020-06-24 22:58:20 +0000
commit81c8ffaa3046245caf3aff5bffe2b971d497ac3d (patch)
tree92804e8f522fa2ec352b4d3bea16d8c2abc645ac /src/rsync/pkg/grpc
parent7b860ae60bf9686b449ab2fe3f18c33944bdd71c (diff)
Instantiation and termination of a given context implementation.
Issue-ID: MULTICLOUD-1005 Signed-off-by: Manjunath Ranganathaiah <manjunath.ranganathaiah@intel.com> Change-Id: I60e11aaad97b60efc24a02866dc0e580507e5296
Diffstat (limited to 'src/rsync/pkg/grpc')
-rw-r--r--src/rsync/pkg/grpc/installappserver/installappserver.go27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/rsync/pkg/grpc/installappserver/installappserver.go b/src/rsync/pkg/grpc/installappserver/installappserver.go
index 28b4a585..68118ade 100644
--- a/src/rsync/pkg/grpc/installappserver/installappserver.go
+++ b/src/rsync/pkg/grpc/installappserver/installappserver.go
@@ -17,10 +17,8 @@ import (
"context"
"encoding/json"
"log"
-
"github.com/onap/multicloud-k8s/src/rsync/pkg/grpc/installapp"
- //"google.golang.org/grpc/codes"
- //"google.golang.org/grpc/status"
+ con "github.com/onap/multicloud-k8s/src/rsync/pkg/context"
)
type installappServer struct {
@@ -31,10 +29,17 @@ func (cs *installappServer) InstallApp(ctx context.Context, req *installapp.Inst
installAppReq, _ := json.Marshal(req)
log.Println("GRPC Server received installAppRequest: ", string(installAppReq))
- // Insert call to Server Functionality here
- //
- //
-
+ // Try instantiate the comp app
+ instca := con.CompositeAppContext{}
+ err := instca.InstantiateComApp(req.GetAppContext())
+ if err != nil {
+ log.Println("Instantiation failed: " + err.Error())
+ err := instca.TerminateComApp(req.GetAppContext())
+ if err != nil {
+ log.Println("Termination failed: " + err.Error())
+ }
+ return &installapp.InstallAppResponse{AppContextInstalled: false}, err
+ }
return &installapp.InstallAppResponse{AppContextInstalled: true}, nil
}
@@ -43,8 +48,12 @@ func (cs *installappServer) UninstallApp(ctx context.Context, req *installapp.Un
log.Println("GRPC Server received uninstallAppRequest: ", string(uninstallAppReq))
// Try terminating the comp app here
- //
- //
+ instca := con.CompositeAppContext{}
+ err := instca.TerminateComApp(req.GetAppContext())
+ if err != nil {
+ log.Println("Termination failed: " + err.Error())
+ return &installapp.UninstallAppResponse{AppContextUninstalled: false}, err
+ }
return &installapp.UninstallAppResponse{AppContextUninstalled: true}, nil
}