mirror of https://github.com/docker/docs.git
Fix bugsnag reports for create
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
38b6ae3ce4
commit
d518e171b9
|
@ -12,10 +12,13 @@ import (
|
|||
|
||||
"errors"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/docker/machine/commands/mcndirs"
|
||||
"github.com/docker/machine/libmachine"
|
||||
"github.com/docker/machine/libmachine/auth"
|
||||
"github.com/docker/machine/libmachine/crashreport"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/docker/machine/libmachine/drivers/rpc"
|
||||
"github.com/docker/machine/libmachine/engine"
|
||||
|
@ -211,7 +214,21 @@ func cmdCreateInner(c CommandLine, api libmachine.API) error {
|
|||
}
|
||||
|
||||
if err := api.Create(h); err != nil {
|
||||
return fmt.Errorf("Error creating machine: %s", err)
|
||||
// Wait for all the logs to reach the client
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
vBoxLog := ""
|
||||
if h.DriverName == "virtualbox" {
|
||||
vBoxLog = filepath.Join(api.GetMachinesDir(), h.Name, h.Name, "Logs", "VBox.log")
|
||||
}
|
||||
|
||||
return crashreport.CrashError{
|
||||
Cause: err,
|
||||
Command: "Create",
|
||||
Context: "api.performCreate",
|
||||
DriverName: h.DriverName,
|
||||
LogFilePath: vBoxLog,
|
||||
}
|
||||
}
|
||||
|
||||
if err := api.Save(h); err != nil {
|
||||
|
|
|
@ -6,13 +6,10 @@ import (
|
|||
|
||||
"io"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/docker/machine/drivers/errdriver"
|
||||
"github.com/docker/machine/libmachine/auth"
|
||||
"github.com/docker/machine/libmachine/cert"
|
||||
"github.com/docker/machine/libmachine/check"
|
||||
"github.com/docker/machine/libmachine/crashreport"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/docker/machine/libmachine/drivers/plugin/localbinary"
|
||||
"github.com/docker/machine/libmachine/drivers/rpc"
|
||||
|
@ -34,6 +31,7 @@ type API interface {
|
|||
NewHost(driverName string, rawDriver []byte) (*host.Host, error)
|
||||
Create(h *host.Host) error
|
||||
persist.Store
|
||||
GetMachinesDir() string
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
|
@ -135,21 +133,7 @@ func (api *Client) Create(h *host.Host) error {
|
|||
log.Info("Creating machine...")
|
||||
|
||||
if err := api.performCreate(h); err != nil {
|
||||
// Wait for all the logs to reach the client
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
vBoxLog := ""
|
||||
if h.DriverName == "virtualbox" {
|
||||
vBoxLog = filepath.Join(api.GetMachinesDir(), h.Name, h.Name, "Logs", "VBox.log")
|
||||
}
|
||||
|
||||
return crashreport.CrashError{
|
||||
Cause: err,
|
||||
Command: "Create",
|
||||
Context: "api.performCreate",
|
||||
DriverName: h.DriverName,
|
||||
LogFilePath: vBoxLog,
|
||||
}
|
||||
return fmt.Errorf("Error creating machine: %s", err)
|
||||
}
|
||||
|
||||
log.Debug("Reticulating splines...")
|
||||
|
|
|
@ -72,6 +72,10 @@ func (api *FakeAPI) Save(host *host.Host) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (api FakeAPI) GetMachinesDir() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func State(api libmachine.API, name string) state.State {
|
||||
host, _ := api.Load(name)
|
||||
machineState, _ := host.Driver.GetState()
|
||||
|
|
Loading…
Reference in New Issue