diff --git a/pkg/pillar/cmd/monitor/ipc_server.go b/pkg/pillar/cmd/monitor/ipc_server.go index ee09688100..d97e80a6db 100644 --- a/pkg/pillar/cmd/monitor/ipc_server.go +++ b/pkg/pillar/cmd/monitor/ipc_server.go @@ -48,7 +48,7 @@ func (r *request) validate() error { return errors.New("RequestData is nil") } // check supported request types - if r.RequestType != "SetDPC" { + if (r.RequestType != "SetDPC") && (r.RequestType != "SetServer") { return errors.New("Unsupported RequestType " + r.RequestType) } return nil @@ -228,6 +228,15 @@ func (r *request) handleRequest(ctx *monitor) *response { return r.errResponse("Failed to publish DPC", err) } return r.okResponse() + case "SetServer": + var server string + if err := json.Unmarshal(r.RequestData, &server); err != nil { + return r.malformedRequestResponse(err) + } + if err := ctx.updateServerFile(server); err != nil { + return r.errResponse("Failed to update server file", err) + } + return r.okResponse() default: return r.unknownRequestResponse()