1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

daemon/config: Reload(): normalize labels before validation

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-04-24 16:14:44 +02:00
parent 1f8d44babf
commit b819480899
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -343,10 +343,6 @@ func Reload(configFile string, flags *pflag.FlagSet, reload func(*Config)) error
newConfig = New()
}
if err := Validate(newConfig); err != nil {
return errors.Wrap(err, "file configuration validation failed")
}
// Check if duplicate label-keys with different values are found
newLabels, err := GetConflictFreeLabels(newConfig.Labels)
if err != nil {
@ -354,6 +350,10 @@ func Reload(configFile string, flags *pflag.FlagSet, reload func(*Config)) error
}
newConfig.Labels = newLabels
if err := Validate(newConfig); err != nil {
return errors.Wrap(err, "file configuration validation failed")
}
reload(newConfig)
return nil
}