Skip to content

Commit db8fed5

Browse files
kashifminmjuraga
authored andcommitted
BUG/MINOR: runtime_server: add missing empty string check for server states
SetServerHealth was being called with empty string as state due to missing checks
1 parent 4efb9a0 commit db8fed5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

handlers/runtime_server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (h *ReplaceRuntimeServerHandlerImpl) Handle(params server.ReplaceRuntimeSer
8686
}
8787

8888
// change operational state
89-
if rs.OperationalState != params.Data.OperationalState {
89+
if params.Data.OperationalState != "" && rs.OperationalState != params.Data.OperationalState {
9090
err = h.Client.Runtime.SetServerHealth(params.Backend, params.Name, params.Data.OperationalState)
9191
if err != nil {
9292
e := misc.HandleError(err)
@@ -95,7 +95,7 @@ func (h *ReplaceRuntimeServerHandlerImpl) Handle(params server.ReplaceRuntimeSer
9595
}
9696

9797
// change admin state
98-
if rs.AdminState != params.Data.AdminState {
98+
if params.Data.AdminState != "" && rs.AdminState != params.Data.AdminState {
9999
err = h.Client.Runtime.SetServerState(params.Backend, params.Name, params.Data.AdminState)
100100
if err != nil {
101101
e := misc.HandleError(err)

0 commit comments

Comments
 (0)