Skip to content

Commit

Permalink
Merge pull request #3659 from tstromberg/console
Browse files Browse the repository at this point in the history
Clearer output when re-using VM's so that users know what they are waiting on
  • Loading branch information
tstromberg authored Feb 14, 2019
2 parents 4608a13 + 3454c83 commit 3714bbd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
6 changes: 0 additions & 6 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ func startHost(api libmachine.API, mc cfg.MachineConfig) (*host.Host, bool) {
if mc.VMDriver == constants.DriverNone {
console.OutStyle("starting-none", "Configuring local host environment ...")
prepareNone()
} else {
if exists {
console.OutStyle("waiting", "Spinning up existing VM for %q ...", cfg.GetMachineName())
} else {
console.OutStyle("starting-vm", "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", mc.VMDriver, mc.CPUs, mc.Memory, mc.DiskSize)
}
}

var host *host.Host
Expand Down
11 changes: 10 additions & 1 deletion pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
return nil, errors.Wrap(err, "Error getting state for host")
}

if s != state.Running {
if s == state.Running {
console.OutStyle("running", "Re-using the currently running %s VM for %q ...", h.Driver.DriverName(), cfg.GetMachineName())
} else {
console.OutStyle("restarting", "Restarting existing %s VM for %q ...", h.Driver.DriverName(), cfg.GetMachineName())
if err := h.Driver.Start(); err != nil {
return nil, errors.Wrap(err, "start")
}
Expand All @@ -106,6 +109,11 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
}

e := engineOptions(config)
glog.Infof("engine options: %+v", e)

// Slightly counter-intuitive, but this is what DetectProvisioner & ConfigureAuth block on.
console.OutStyle("waiting", "Waiting for SSH access ...")

if len(e.Env) > 0 {
h.HostOptions.EngineOptions.Env = e.Env
provisioner, err := provision.DetectProvisioner(h.Driver)
Expand Down Expand Up @@ -264,6 +272,7 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error
return nil, err
}

console.OutStyle("starting-vm", "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", config.VMDriver, config.CPUs, config.Memory, config.DiskSize)
def, err := registry.Driver(config.VMDriver)
if err != nil {
if err == registry.ErrDriverNotFound {
Expand Down
36 changes: 19 additions & 17 deletions pkg/minikube/console/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ type style struct {
// styles is a map of style name to style struct
// For consistency, ensure that emojis added render with the same width across platforms.
var styles = map[string]style{
"happy": {Prefix: "πŸ˜„ "},
"success": {Prefix: "βœ… "},
"failure": {Prefix: "❌ "},
"conflict": {Prefix: "πŸ’₯ "},
"fatal": {Prefix: "πŸ’£ "},
"notice": {Prefix: "πŸ“Œ "},
"ready": {Prefix: "πŸ„ "},
"restarting": {Prefix: "πŸ”„ "},
"stopping": {Prefix: "βœ‹ "},
"stopped": {Prefix: "πŸ›‘ "},
"warning": {Prefix: "⚠️ "},
"waiting": {Prefix: "βŒ› "},
"usage": {Prefix: "πŸ’‘ "},
"launch": {Prefix: "πŸš€ "},
"thumbs-up": {Prefix: "πŸ‘ "},
"option": {Prefix: " β–ͺ "}, // Indented bullet
"crushed": {Prefix: "πŸ’” "},
"happy": {Prefix: "πŸ˜„ "},
"success": {Prefix: "βœ… "},
"failure": {Prefix: "❌ "},
"conflict": {Prefix: "πŸ’₯ "},
"fatal": {Prefix: "πŸ’£ "},
"notice": {Prefix: "πŸ“Œ "},
"ready": {Prefix: "πŸ„ "},
"restarting": {Prefix: "πŸ”„ "},
"running": {Prefix: "πŸƒ "},
"provisioning": {Prefix: "🌱 "},
"stopping": {Prefix: "βœ‹ "},
"stopped": {Prefix: "πŸ›‘ "},
"warning": {Prefix: "⚠️ "},
"waiting": {Prefix: "βŒ› "},
"usage": {Prefix: "πŸ’‘ "},
"launch": {Prefix: "πŸš€ "},
"thumbs-up": {Prefix: "πŸ‘ "},
"option": {Prefix: " β–ͺ "}, // Indented bullet
"crushed": {Prefix: "πŸ’” "},

// Specialized purpose styles
"iso-download": {Prefix: "πŸ’Ώ "},
Expand Down

0 comments on commit 3714bbd

Please sign in to comment.