Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider setup needed to clean a errored vm with docker-machine #373

Merged
merged 1 commit into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion processors/implode.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func purgeConfiguration() error {

// implode the global dir
if err := os.RemoveAll(config.GlobalDir()); err != nil {
return util.ErrorAppend(err, "failed to purge the data directory")
return util.ErrorAppend(util.ErrorQuiet(err), "failed to purge the data directory")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion processors/provider/bridge/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func setupContainer() error {
}
display.StopTask()

display.StartTask("Configuring")
display.StartTask("Setting up container")
// run the configure hook
if _, err := hookit.DebugExec(container.ID, "configure", "{\"platform\":\"local\",\"config\":{}}", "info"); err != nil {
return util.ErrorAppend(err, "failed to run configure hook")
Expand Down
15 changes: 10 additions & 5 deletions util/provider/dockermachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"

"github.com/nanobox-io/nanobox/models"
"github.com/nanobox-io/nanobox/util"
"github.com/nanobox-io/nanobox/util/display"
// "github.com/nanobox-io/nanobox/util/fileutil"
"github.com/nanobox-io/nanobox/util/vbox"
Expand Down Expand Up @@ -97,6 +98,9 @@ func (machine DockerMachine) Create() error {
return nil
}

// make sure dockermachine is clean
exec.Command(dockerMachineCmd, "rm", "-f", "nanobox").Run()

display.ProviderSetup()

// load the configuration for docker-machine
Expand Down Expand Up @@ -139,14 +143,14 @@ func (machine DockerMachine) Create() error {

process := exec.Command(cmd[0], cmd[1:]...)

process.Stdout = display.NewStreamer("info")
process.Stderr = display.NewStreamer("info")
// process.Stdout = display.NewStreamer("info")
// process.Stderr = display.NewStreamer("info")

display.StartTask("Launching VM")

if err := process.Run(); err != nil {
if out, err := process.CombinedOutput(); err != nil {
display.ErrorTask()
return err
return util.Errorf("%s: %s", err, out)
}

display.StopTask()
Expand Down Expand Up @@ -737,7 +741,8 @@ func (machine DockerMachine) isCreated() bool {
return false
}

if bytes.Contains(output, []byte("Host does not exist: \"nanobox\"")) {
if bytes.Contains(output, []byte("Host does not exist: \"nanobox\"")) ||
bytes.Contains(output, []byte("error")) {
return false
}

Expand Down