From 3b8c11b1b30a5a1ec49d2d15f91156c877e8f830 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn <github@gone.nl> Date: Mon, 25 Apr 2016 15:57:28 +0200 Subject: [PATCH] fix reloading of daemon labels from config commit 20a038eca68e4188e1cd812293aea8cb220cf08f 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 commit 455858fc70e3b752fb2495bbdda368613e6587c2) --- daemon/daemon.go | 2 +- daemon/daemon_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 43b3e48ef4..b2102b646d 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -1605,7 +1605,7 @@ func (daemon *Daemon) initDiscovery(config *Config) error { func (daemon *Daemon) Reload(config *Config) error { daemon.configStore.reloadLock.Lock() defer daemon.configStore.reloadLock.Unlock() - if config.IsValueSet("label") { + if config.IsValueSet("labels") { daemon.configStore.Labels = config.Labels } if config.IsValueSet("debug") { diff --git a/daemon/daemon_test.go b/daemon/daemon_test.go index 382aac29e3..da6bc25d88 100644 --- a/daemon/daemon_test.go +++ b/daemon/daemon_test.go @@ -320,7 +320,7 @@ func TestDaemonReloadLabels(t *testing.T) { } valuesSets := make(map[string]interface{}) - valuesSets["label"] = "foo:baz" + valuesSets["labels"] = "foo:baz" newConfig := &Config{ CommonConfig: CommonConfig{ Labels: []string{"foo:baz"}, @@ -345,7 +345,7 @@ func TestDaemonReloadNotAffectOthers(t *testing.T) { } valuesSets := make(map[string]interface{}) - valuesSets["label"] = "foo:baz" + valuesSets["labels"] = "foo:baz" newConfig := &Config{ CommonConfig: CommonConfig{ Labels: []string{"foo:baz"},