Skip to content

Commit

Permalink
go.d dyncfg return 200 on Enable for running jobs (netdata#17611)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyam8 authored May 7, 2024
1 parent f932c1d commit 46657d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ func (m *Manager) dyncfgConfigEnable(fn functions.Function) {

switch ecfg.status {
case dyncfgAccepted, dyncfgDisabled, dyncfgFailed:
case dyncfgRunning:
// non-dyncfg update triggers enable/disable
m.dyncfgRespf(fn, 200, "")
m.dyncfgJobStatus(ecfg.cfg, ecfg.status)
return
default:
m.Warningf("dyncfg: enable: module %s job %s: enabling not allowed in %s state", mn, jn, ecfg.status)
m.dyncfgRespf(fn, 405, "Enabling data collection job is not allowed in '%s' state.", ecfg.status)
Expand Down
4 changes: 2 additions & 2 deletions src/go/collectors/go.d.plugin/agent/jobmgr/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,8 @@ FUNCTION_RESULT_END
CONFIG go.d:collector:success:test status running
FUNCTION_RESULT_BEGIN 3-enable 405 application/json
{"status":405,"message":"Enabling data collection job is not allowed in 'running' state."}
FUNCTION_RESULT_BEGIN 3-enable 200 application/json
{"status":200,"message":""}
FUNCTION_RESULT_END
CONFIG go.d:collector:success:test status running
Expand Down

0 comments on commit 46657d7

Please sign in to comment.