瀏覽代碼

Check for conflicting daemon config options in NewDaemon

Signed-off-by: Solomon Hykes <solomon@docker.com>
Solomon Hykes 11 年之前
父節點
當前提交
1eba59eb24
共有 2 個文件被更改,包括 7 次插入9 次删除
  1. 7 0
      daemon/daemon.go
  2. 0 9
      docker/daemon.go

+ 7 - 0
daemon/daemon.go

@@ -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
 

+ 0 - 9
docker/daemon.go

@@ -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