From c07511243c0481774dd91dbb6462527582f60822 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Fri, 16 May 2014 14:44:00 +1000 Subject: [PATCH] we don't use Env vars like this, so tell the user the cmdline option they could use --- cmds.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmds.go b/cmds.go index 9dd8e16..e8802f1 100644 --- a/cmds.go +++ b/cmds.go @@ -20,14 +20,19 @@ import ( // Initialize the boot2docker VM from scratch. func cmdInit() int { // TODO(@riobard) break up this command into multiple stages + m, err := vbx.GetMachine(B2D.VM) + if err == nil { + logf("Virtual machine %s already exists", B2D.VM) + return 1 + } if ping(fmt.Sprintf("localhost:%d", B2D.DockerPort)) { - logf("DOCKER_PORT=%d on localhost is occupied. Please choose another one.", B2D.DockerPort) + logf("--dockerport=%d on localhost is occupied. Please choose another one.", B2D.DockerPort) return 1 } if ping(fmt.Sprintf("localhost:%d", B2D.SSHPort)) { - logf("SSH_PORT=%d on localhost is occupied. Please choose another one.", B2D.SSHPort) + logf("--sshport=%d on localhost is occupied. Please choose another one.", B2D.SSHPort) return 1 } @@ -54,7 +59,7 @@ func cmdInit() int { //TODO: print a ~/.ssh/config entry for our b2d connection that the user can c&p logf("Creating VM %s...", B2D.VM) - m, err := vbx.CreateMachine(B2D.VM, "") + m, err = vbx.CreateMachine(B2D.VM, "") if err != nil { logf("Failed to create VM %q: %s", B2D.VM, err) return 1