Skip to content

Commit

Permalink
add auth
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelmsft committed May 23, 2024
1 parent 07c51ec commit c50036d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gnmi_server/gnoi.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func KillOrRestartProcess(restart bool, serviceName string) error {
}

func (srv *Server) KillProcess(ctx context.Context, req *gnoi_system_pb.KillProcessRequest) (*gnoi_system_pb.KillProcessResponse, error) {
_, err := authenticate(srv.config.UserAuth, ctx)
if err != nil {
return nil, err
}

serviceName := req.GetName()
restart := req.GetRestart()
if req.GetPid() != 0 {
Expand All @@ -52,7 +57,7 @@ func (srv *Server) KillProcess(ctx context.Context, req *gnoi_system_pb.KillProc
}
log.V(1).Info("gNOI: KillProcess with optional restart")
log.V(1).Info("Request: ", req)
err := KillOrRestartProcess(restart, serviceName)
err = KillOrRestartProcess(restart, serviceName)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c50036d

Please sign in to comment.