Skip to content

Commit

Permalink
Handle SetServer request
Browse files Browse the repository at this point in the history
- Setting server URL in both /config/server and real config partition

Signed-off-by: Mikhail Malyshev <[email protected]>
  • Loading branch information
rucoder committed Nov 25, 2024
1 parent 6af4fd5 commit b661125
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/pillar/cmd/monitor/ipc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b661125

Please sign in to comment.