From 455858fc70e3b752fb2495bbdda368613e6587c2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn 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 --- 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 fe5e9d153e..1e91fd694c 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -1498,7 +1498,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"},