From b4636318d5d68fae7ba6b8087a9ad35e13d9a360 Mon Sep 17 00:00:00 2001 From: Arumugam J Date: Tue, 26 Sep 2023 12:35:02 -0400 Subject: [PATCH] Don't delete INI jobs If a job is configured in the INI file but not mentioned in the docker labels, do not deregister the job. --- cli/config.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/cli/config.go b/cli/config.go index 713bf25d1..e7030fb0b 100644 --- a/cli/config.go +++ b/cli/config.go @@ -140,11 +140,9 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) { // Calculate the delta execJobs for name, j := range c.ExecJobs { - found := false for newJobsName, newJob := range parsedLabelConfig.ExecJobs { // Check if the schedule has changed if name == newJobsName { - found = true // There is a slight race condition were a job can be canceled / restarted with different params // so, lets take care of it by simply restarting // For the hash to work properly, we must fill the fields before calling it @@ -163,11 +161,6 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) { break } } - if !found { - // Remove the job - c.sh.RemoveJob(j) - delete(c.ExecJobs, name) - } } // Check for aditions @@ -190,11 +183,9 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) { } for name, j := range c.RunJobs { - found := false for newJobsName, newJob := range parsedLabelConfig.RunJobs { // Check if the schedule has changed if name == newJobsName { - found = true // There is a slight race condition were a job can be canceled / restarted with different params // so, lets take care of it by simply restarting // For the hash to work properly, we must fill the fields before calling it @@ -213,11 +204,6 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) { break } } - if !found { - // Remove the job - c.sh.RemoveJob(j) - delete(c.RunJobs, name) - } } // Check for aditions @@ -238,7 +224,6 @@ func (c *Config) dockerLabelsUpdate(labels map[string]map[string]string) { c.RunJobs[newJobsName] = newJob } } - } // ExecJobConfig contains all configuration params needed to build a ExecJob