From 46f4a457692bbaf5902aca4bcfb4ce3cd07a7713 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 23 Sep 2022 19:25:38 +0200 Subject: [PATCH] libnetwork/config: remove ParseConfig() Libnetwork configuration files were only used as part of integration tests using the dnet utility, which was removed in 7266a956a88228cd5aed26894b296ad4ffc6e2f6 Signed-off-by: Sebastiaan van Stijn --- libnetwork/config/config.go | 19 ------------------- libnetwork/config/config_test.go | 14 -------------- libnetwork/config/libnetwork.toml | 9 --------- 3 files changed, 42 deletions(-) delete mode 100644 libnetwork/config/libnetwork.toml diff --git a/libnetwork/config/config.go b/libnetwork/config/config.go index cafe7cd23c..3c7da720e7 100644 --- a/libnetwork/config/config.go +++ b/libnetwork/config/config.go @@ -1,7 +1,6 @@ package config import ( - "os" "strings" "github.com/docker/docker/libnetwork/cluster" @@ -11,7 +10,6 @@ import ( "github.com/docker/docker/libnetwork/osl" "github.com/docker/docker/pkg/plugingetter" "github.com/docker/libkv/store" - "github.com/pelletier/go-toml" "github.com/sirupsen/logrus" ) @@ -51,23 +49,6 @@ func (c *Config) LoadDefaultScopes(dataDir string) { } } -// ParseConfig parses the libnetwork configuration file -func ParseConfig(tomlCfgFile string) (*Config, error) { - cfg := &Config{ - Scopes: map[string]*datastore.ScopeCfg{}, - } - data, err := os.ReadFile(tomlCfgFile) - if err != nil { - return nil, err - } - if err := toml.Unmarshal(data, cfg); err != nil { - return nil, err - } - - cfg.LoadDefaultScopes(cfg.Daemon.DataDir) - return cfg, nil -} - // ParseConfigOptions parses the configuration options and returns // a reference to the corresponding Config structure func ParseConfigOptions(opts ...Option) *Config { diff --git a/libnetwork/config/config_test.go b/libnetwork/config/config_test.go index cb71002422..c0decffc43 100644 --- a/libnetwork/config/config_test.go +++ b/libnetwork/config/config_test.go @@ -7,20 +7,6 @@ import ( "github.com/docker/docker/libnetwork/netlabel" ) -func TestInvalidConfig(t *testing.T) { - _, err := ParseConfig("invalid.toml") - if err == nil { - t.Fatal("Invalid Configuration file must fail") - } -} - -func TestConfig(t *testing.T) { - _, err := ParseConfig("libnetwork.toml") - if err != nil { - t.Fatal("Error parsing a valid configuration file :", err) - } -} - func TestOptionsLabels(t *testing.T) { c := &Config{} l := []string{ diff --git a/libnetwork/config/libnetwork.toml b/libnetwork/config/libnetwork.toml deleted file mode 100644 index 3f07d27df0..0000000000 --- a/libnetwork/config/libnetwork.toml +++ /dev/null @@ -1,9 +0,0 @@ -title = "LibNetwork Configuration file" - -[daemon] - debug = false -[cluster] - discovery = "token://swarm-discovery-token" - Address = "Cluster-wide reachable Host IP" -[datastore] - embedded = false