mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon: restore: fix fluentd-async-connect migration for downgrades
The "fluentd-async-connect" option was deprecated in 20.10 throughcc1f3c750e, and removed in 28.0 trough49ec488036, which added migration code on daemon startup. However, the migration code _copied_ the deprecated option to the new ("fluentd-async") option, preserving the old field. Doing so could cause an issue if a user would downgrade the daemon to a previous release, as the changes incc1f3c750einvalidate a config that has both fields set (see [daemon/logger/fluentd/fluentd.go#L198-L200]); if cfg[asyncKey] != "" && cfg[asyncConnectKey] != "" { return config, errors.Errorf("conflicting options: cannot specify both '%s' and '%s", asyncKey, asyncConnectKey) } This patch updates the migration code to remove the deprecated option. [daemon/logger/fluentd/fluentd.go#L198-L200]:cc1f3c750e/daemon/logger/fluentd/fluentd.go (L198-L200)Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -335,10 +335,11 @@ func (daemon *Daemon) restore(cfg *configStore) error {
|
||||
// deprecated in v20.10 in favor of 'fluentd-async', and
|
||||
// removed in v28.0.
|
||||
// TODO(aker): remove this migration once the next LTS version of MCR is released.
|
||||
if _, ok := c.HostConfig.LogConfig.Config["fluentd-async-connect"]; ok {
|
||||
if v, ok := c.HostConfig.LogConfig.Config["fluentd-async-connect"]; ok {
|
||||
if _, ok := c.HostConfig.LogConfig.Config["fluentd-async"]; !ok {
|
||||
c.HostConfig.LogConfig.Config["fluentd-async"] = c.HostConfig.LogConfig.Config["fluentd-async-connect"]
|
||||
c.HostConfig.LogConfig.Config["fluentd-async"] = v
|
||||
}
|
||||
delete(c.HostConfig.LogConfig.Config, "fluentd-async-connect")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user