diff options
Diffstat (limited to 'src/rsync/pkg/grpc')
-rw-r--r-- | src/rsync/pkg/grpc/installappserver/installappserver.go | 27 |
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 } |