Skip to content

Commit

Permalink
Merge pull request docker#2645 from dgageot/2370-add-feedback
Browse files Browse the repository at this point in the history
FIX docker#2370 add feedback to the user
  • Loading branch information
jeanlaurent committed Dec 21, 2015
2 parents cd6690c + 34b6468 commit 6e8aaa0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions libmachine/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,30 @@ func (h *Host) runActionForState(action func() error, desiredState state.State)
}

func (h *Host) Start() error {
return h.runActionForState(h.Driver.Start, state.Running)
if err := h.runActionForState(h.Driver.Start, state.Running); err != nil {
return err
}

log.Infof("Machine %q was started.", h.Name)
return nil
}

func (h *Host) Stop() error {
return h.runActionForState(h.Driver.Stop, state.Stopped)
if err := h.runActionForState(h.Driver.Stop, state.Stopped); err != nil {
return err
}

log.Infof("Machine %q was stopped.", h.Name)
return nil
}

func (h *Host) Kill() error {
return h.runActionForState(h.Driver.Kill, state.Stopped)
if err := h.runActionForState(h.Driver.Kill, state.Stopped); err != nil {
return err
}

log.Infof("Machine %q was killed.", h.Name)
return nil
}

func (h *Host) Restart() error {
Expand Down

0 comments on commit 6e8aaa0

Please sign in to comment.