From cbc0d7a65aed875224ed0ef23cb5287813a5e360 Mon Sep 17 00:00:00 2001 From: Malte Bauch <malte.bauch@stud.h-da.de> Date: Mon, 25 Jan 2021 19:42:24 +0100 Subject: [PATCH] small cli-handling changes --- nucleus/cli-handling.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nucleus/cli-handling.go b/nucleus/cli-handling.go index 282a12b05..8fba4a5d3 100644 --- a/nucleus/cli-handling.go +++ b/nucleus/cli-handling.go @@ -166,6 +166,7 @@ func (s *server) CreatePND(ctx context.Context, in *pb.CreatePNDRequest) (*pb.Cr } func (s *server) GetAllPNDs(ctx context.Context, in *emptypb.Empty) (*pb.AllPNDsReply, error) { + log.Info("Received: Get all PNDs") var pnds []*pb.PND for uuidPND, pnd := range s.core.principalNetworkDomains { var devices []*pb.Device @@ -189,6 +190,7 @@ func (s *server) GetAllPNDs(ctx context.Context, in *emptypb.Empty) (*pb.AllPNDs } func (s *server) AddDevice(ctx context.Context, in *pb.AddDeviceRequest) (*pb.AddDeviceReply, error) { + path := viper.GetString("pnd.path") uuidPND, err := uuid.Parse(in.UuidPND) pnd := s.core.principalNetworkDomains[uuidPND] @@ -204,5 +206,8 @@ func (s *server) AddDevice(ctx context.Context, in *pb.AddDeviceRequest) (*pb.Ad } devicesMap := pnd.(*pndImplementation).Devices devicesMap[newDevice.Uuid] = newDevice + if err := s.core.savePNDs(path); err != nil { + log.Info(err) + } return &pb.AddDeviceReply{Message: "Added new Device: " + newDevice.Uuid.String()}, err } -- GitLab