From 67c254a60a77c1f80804be7ab97353530987c846 Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Tue, 16 Sep 2014 10:37:50 -0700 Subject: [PATCH 1/2] DisableNetworkBidge doesn't need to be public anymore Docker-DCO-1.1-Signed-off-by: Jessica Frazelle (github: jfrazelle) --- daemon/config.go | 2 +- daemon/daemon.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/daemon/config.go b/daemon/config.go index 07d41153a3..00ebc7a74d 100644 --- a/daemon/config.go +++ b/daemon/config.go @@ -10,7 +10,7 @@ import ( const ( defaultNetworkMtu = 1500 - DisableNetworkBridge = "none" + disableNetworkBridge = "none" ) // Config define the configuration of a docker daemon diff --git a/daemon/daemon.go b/daemon/daemon.go index b9c652cb4e..5fef43b357 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -690,8 +690,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) 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 + config.DisableNetwork = config.BridgeIface == disableNetworkBridge // Claim the pidfile first, to avoid any and all unexpected race conditions. // Some of the init doesn't need a pidfile lock - but let's not try to be smart. From 23b2c39a40186ce9b6deb4ae9201d5c20cc75abe Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Tue, 16 Sep 2014 10:42:59 -0700 Subject: [PATCH 2/2] Return errors in NewDaemonFromDirectory instead of calling Fatal Docker-DCO-1.1-Signed-off-by: Jessica Frazelle (github: jfrazelle) --- daemon/daemon.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 5fef43b357..0eab60420e 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -705,25 +705,24 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) } // Check that the system is supported and we have sufficient privileges - // FIXME: return errors instead of calling Fatal if runtime.GOOS != "linux" { - log.Fatalf("The Docker daemon is only supported on linux") + return nil, fmt.Errorf("The Docker daemon is only supported on linux") } if os.Geteuid() != 0 { - log.Fatalf("The Docker daemon needs to be run as root") + return nil, fmt.Errorf("The Docker daemon needs to be run as root") } if err := checkKernelAndArch(); err != nil { - log.Fatalf(err.Error()) + return nil, err } // set up the TempDir to use a canonical path tmp, err := utils.TempDir(config.Root) if err != nil { - log.Fatalf("Unable to get the TempDir under %s: %s", config.Root, err) + return nil, fmt.Errorf("Unable to get the TempDir under %s: %s", config.Root, err) } realTmp, err := utils.ReadSymlinkedDirectory(tmp) if err != nil { - log.Fatalf("Unable to get the full path to the TempDir (%s): %s", tmp, err) + return nil, fmt.Errorf("Unable to get the full path to the TempDir (%s): %s", tmp, err) } os.Setenv("TMPDIR", realTmp) if !config.EnableSelinuxSupport { @@ -737,7 +736,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) } else { realRoot, err = utils.ReadSymlinkedDirectory(config.Root) if err != nil { - log.Fatalf("Unable to get the full path to root (%s): %s", config.Root, err) + return nil, fmt.Errorf("Unable to get the full path to root (%s): %s", config.Root, err) } } config.Root = realRoot