Check for conflicting daemon config options in NewDaemon

Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
Solomon Hykes 2014-08-10 03:58:19 +00:00
Родитель ca11b77471
Коммит 1eba59eb24
2 изменённых файлов: 7 добавлений и 9 удалений

Просмотреть файл

@ -677,6 +677,13 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
// FIXME: GetDefaultNetwork Mtu doesn't need to be public anymore
config.Mtu = GetDefaultNetworkMtu()
}
// Check for mutually incompatible config options
if config.BridgeIface != "" && config.BridgeIP != "" {
return nil, fmt.Errorf("You specified -b & --bip, mutually exclusive options. Please specify only one.")
}
if !config.EnableIptables && !config.InterContainerCommunication {
return nil, fmt.Errorf("You specified --iptables=false with --icc=false. ICC uses iptables to function. Please set --icc or --iptables to true.")
}
// FIXME: DisableNetworkBidge doesn't need to be public anymore
config.DisableNetwork = config.BridgeIface == DisableNetworkBridge

Просмотреть файл

@ -30,15 +30,6 @@ func mainDaemon() {
flag.Usage()
return
}
// FIXME: validate daemon.Config values in a method of daemon.Config
if daemonCfg.BridgeIface != "" && daemonCfg.BridgeIP != "" {
log.Fatal("You specified -b & --bip, mutually exclusive options. Please specify only one.")
}
if !daemonCfg.EnableIptables && !daemonCfg.InterContainerCommunication {
log.Fatal("You specified --iptables=false with --icc=false. ICC uses iptables to function. Please set --icc or --iptables to true.")
}
eng := engine.New()
signal.Trap(eng.Shutdown)
// Load builtins