From c5ef32340dc368bffd2ec43a7ae920838b26f51f Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Sun, 18 Dec 2022 13:14:26 +0100 Subject: [PATCH] improve warning message Signed-off-by: Nicolas De Loof --- loader/loader.go | 4 ++-- loader/loader_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/loader/loader.go b/loader/loader.go index 784cdb25..4449ba02 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -687,7 +687,7 @@ func resolveVolumePath(volume types.ServiceVolumeConfig, workingDir string, look } func resolveSecretsPath(secret types.SecretConfig, workingDir string, lookupEnv template.Mapping) types.SecretConfig { - if ! secret.External.External && secret.File != "" { + if !secret.External.External && secret.File != "" { secret.File = resolveMaybeUnixPath(secret.File, workingDir, lookupEnv) } return secret @@ -741,7 +741,7 @@ func LoadNetworks(source map[string]interface{}) (map[string]types.NetworkConfig if network.Name != "" { return nil, errors.Errorf("network %s: network.external.name and network.name conflict; only use network.name", name) } - logrus.Warnf("network %s: network.external.name is deprecated in favor of network.name", name) + logrus.Warnf("network %s: network.external.name is deprecated. Please set network.name with external: true", name) network.Name = network.External.Name network.External.Name = "" case network.Name == "": diff --git a/loader/loader_test.go b/loader/loader_test.go index 8c1cceca..a7552492 100644 --- a/loader/loader_test.go +++ b/loader/loader_test.go @@ -1455,7 +1455,7 @@ func TestLoadNetworksWarnOnDeprecatedExternalName(t *testing.T) { }, } assert.Check(t, is.DeepEqual(expected, networks)) - assert.Check(t, strings.Contains(buf.String(), "network foo: network.external.name is deprecated in favor of network.name")) + assert.Check(t, strings.Contains(buf.String(), "network foo: network.external.name is deprecated. Please set network.name with external: true")) } func TestLoadNetworkInvalidExternalNameAndNameCombination(t *testing.T) { @@ -1861,13 +1861,13 @@ func TestLoadWithExtends(t *testing.T) { }, Environment: types.MappingWithEquals{}, Networks: map[string]*types.ServiceNetworkConfig{"default": nil}, - Volumes: []types.ServiceVolumeConfig{{ + Volumes: []types.ServiceVolumeConfig{{ Type: "bind", Source: "/opt/data", Target: "/var/lib/mysql", Bind: &types.ServiceVolumeBind{CreateHostPath: true}, }}, - Scale: 1, + Scale: 1, }, } assert.Check(t, is.DeepEqual(expServices, actual.Services))