mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
libnetwork/config: remove ParseConfig()
Libnetwork configuration files were only used as part of integration tests using
the dnet utility, which was removed in 7266a956a8
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
7d574f5ac6
commit
46f4a45769
3 changed files with 0 additions and 42 deletions
|
@ -1,7 +1,6 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/libnetwork/cluster"
|
"github.com/docker/docker/libnetwork/cluster"
|
||||||
|
@ -11,7 +10,6 @@ import (
|
||||||
"github.com/docker/docker/libnetwork/osl"
|
"github.com/docker/docker/libnetwork/osl"
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
"github.com/docker/libkv/store"
|
"github.com/docker/libkv/store"
|
||||||
"github.com/pelletier/go-toml"
|
|
||||||
"github.com/sirupsen/logrus"
|
"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
|
// ParseConfigOptions parses the configuration options and returns
|
||||||
// a reference to the corresponding Config structure
|
// a reference to the corresponding Config structure
|
||||||
func ParseConfigOptions(opts ...Option) *Config {
|
func ParseConfigOptions(opts ...Option) *Config {
|
||||||
|
|
|
@ -7,20 +7,6 @@ import (
|
||||||
"github.com/docker/docker/libnetwork/netlabel"
|
"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) {
|
func TestOptionsLabels(t *testing.T) {
|
||||||
c := &Config{}
|
c := &Config{}
|
||||||
l := []string{
|
l := []string{
|
||||||
|
|
|
@ -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
|
|
Loading…
Add table
Reference in a new issue