Skip to content

Commit 4197abe

Browse files
committed
test
Signed-off-by: Timur Tuktamyshev <timur.tuktamyshev@flant.com>
1 parent c29cb92 commit 4197abe

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pkg/module_manager/module_manager.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,18 @@ func (mm *ModuleManager) EnableModuleScheduleBindings(moduleName string) {
894894
}
895895
}
896896

897+
// DisableModuleScheduleBindings disables schedule bindings of the module's hooks
898+
func (mm *ModuleManager) DisableModuleScheduleBindings(moduleName string) {
899+
ml := mm.GetModule(moduleName)
900+
if !ml.HooksControllersReady() {
901+
return
902+
}
903+
schHooks := ml.GetHooks(Schedule)
904+
for _, mh := range schHooks {
905+
mh.GetHookController().DisableScheduleBindings()
906+
}
907+
}
908+
897909
// DisableModuleHooks disables monitors/bindings of the module's hooks
898910
// It's advisable to use this method only if next step is to completely disable the module (as a short-term commitment).
899911
// Otherwise, as hooks are rather stateless, their confiuration may get overwritten, resulting in unexpected consequences.

pkg/task/tasks/converge-modules/task.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ func (s *Task) Handle(ctx context.Context) queue.TaskResult {
147147
// TODO disable hooks before was done in DiscoverModulesStateRefresh. Should we stick to this solution or disable events later during the handling each ModuleDelete task?
148148
// Disable events for disabled modules.
149149
for _, moduleName := range state.ModulesToDisable {
150-
s.moduleManager.DisableModuleHooks(moduleName)
150+
s.moduleManager.DisableModuleScheduleBindings(moduleName)
151+
// s.moduleManager.DisableModuleHooks(moduleName)
151152
// op.DrainModuleQueues(moduleName)
152153
}
153154
// Set ModulesToEnable list to properly run onStartup hooks for first converge.

0 commit comments

Comments
 (0)