Browse code

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>

Sebastiaan van Stijn authored on 2016/04/25 22:57:28
Showing 2 changed files
... ...
@@ -1498,7 +1498,7 @@ func (daemon *Daemon) initDiscovery(config *Config) error {
1498 1498
 func (daemon *Daemon) Reload(config *Config) error {
1499 1499
 	daemon.configStore.reloadLock.Lock()
1500 1500
 	defer daemon.configStore.reloadLock.Unlock()
1501
-	if config.IsValueSet("label") {
1501
+	if config.IsValueSet("labels") {
1502 1502
 		daemon.configStore.Labels = config.Labels
1503 1503
 	}
1504 1504
 	if config.IsValueSet("debug") {
... ...
@@ -320,7 +320,7 @@ func TestDaemonReloadLabels(t *testing.T) {
320 320
 	}
321 321
 
322 322
 	valuesSets := make(map[string]interface{})
323
-	valuesSets["label"] = "foo:baz"
323
+	valuesSets["labels"] = "foo:baz"
324 324
 	newConfig := &Config{
325 325
 		CommonConfig: CommonConfig{
326 326
 			Labels:    []string{"foo:baz"},
... ...
@@ -345,7 +345,7 @@ func TestDaemonReloadNotAffectOthers(t *testing.T) {
345 345
 	}
346 346
 
347 347
 	valuesSets := make(map[string]interface{})
348
-	valuesSets["label"] = "foo:baz"
348
+	valuesSets["labels"] = "foo:baz"
349 349
 	newConfig := &Config{
350 350
 		CommonConfig: CommonConfig{
351 351
 			Labels:    []string{"foo:baz"},