mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
fix reloading of daemon labels from config
commit20a038eca6
changed daemon configuration reloading to check if a value was actually set, however, it checked for the wrong property ("label" instead of "labels"), which resulted in the labels only to be loaded from daemon.json if both a "label" -and- a "labels" property was present. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit455858fc70
)
This commit is contained in:
parent
0c8c9bada9
commit
3b8c11b1b3
2 changed files with 3 additions and 3 deletions
|
@ -1605,7 +1605,7 @@ func (daemon *Daemon) initDiscovery(config *Config) error {
|
||||||
func (daemon *Daemon) Reload(config *Config) error {
|
func (daemon *Daemon) Reload(config *Config) error {
|
||||||
daemon.configStore.reloadLock.Lock()
|
daemon.configStore.reloadLock.Lock()
|
||||||
defer daemon.configStore.reloadLock.Unlock()
|
defer daemon.configStore.reloadLock.Unlock()
|
||||||
if config.IsValueSet("label") {
|
if config.IsValueSet("labels") {
|
||||||
daemon.configStore.Labels = config.Labels
|
daemon.configStore.Labels = config.Labels
|
||||||
}
|
}
|
||||||
if config.IsValueSet("debug") {
|
if config.IsValueSet("debug") {
|
||||||
|
|
|
@ -320,7 +320,7 @@ func TestDaemonReloadLabels(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
valuesSets := make(map[string]interface{})
|
valuesSets := make(map[string]interface{})
|
||||||
valuesSets["label"] = "foo:baz"
|
valuesSets["labels"] = "foo:baz"
|
||||||
newConfig := &Config{
|
newConfig := &Config{
|
||||||
CommonConfig: CommonConfig{
|
CommonConfig: CommonConfig{
|
||||||
Labels: []string{"foo:baz"},
|
Labels: []string{"foo:baz"},
|
||||||
|
@ -345,7 +345,7 @@ func TestDaemonReloadNotAffectOthers(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
valuesSets := make(map[string]interface{})
|
valuesSets := make(map[string]interface{})
|
||||||
valuesSets["label"] = "foo:baz"
|
valuesSets["labels"] = "foo:baz"
|
||||||
newConfig := &Config{
|
newConfig := &Config{
|
||||||
CommonConfig: CommonConfig{
|
CommonConfig: CommonConfig{
|
||||||
Labels: []string{"foo:baz"},
|
Labels: []string{"foo:baz"},
|
||||||
|
|
Loading…
Add table
Reference in a new issue