Merge pull request #172 from mlaventure/better-error-for-pause-and-resume
Return the runtime error message on failed pause and resume calls
This commit is contained in:
commit
cb3c208a4d
2 changed files with 12 additions and 4 deletions
|
@ -53,13 +53,21 @@ func (c *container) Runtime() string {
|
||||||
func (c *container) Pause() error {
|
func (c *container) Pause() error {
|
||||||
args := c.runtimeArgs
|
args := c.runtimeArgs
|
||||||
args = append(args, "pause", c.id)
|
args = append(args, "pause", c.id)
|
||||||
return exec.Command(c.runtime, args...).Run()
|
b, err := exec.Command(c.runtime, args...).CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf(string(b))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *container) Resume() error {
|
func (c *container) Resume() error {
|
||||||
args := c.runtimeArgs
|
args := c.runtimeArgs
|
||||||
args = append(args, "resume", c.id)
|
args = append(args, "resume", c.id)
|
||||||
return exec.Command(c.runtime, args...).Run()
|
b, err := exec.Command(c.runtime, args...).CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf(string(b))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *container) Checkpoints() ([]Checkpoint, error) {
|
func (c *container) Checkpoints() ([]Checkpoint, error) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (s *Supervisor) updateContainer(t *UpdateTask) error {
|
||||||
switch t.State {
|
switch t.State {
|
||||||
case runtime.Running:
|
case runtime.Running:
|
||||||
if err := container.Resume(); err != nil {
|
if err := container.Resume(); err != nil {
|
||||||
return ErrUnknownContainerStatus
|
return err
|
||||||
}
|
}
|
||||||
s.notifySubscribers(Event{
|
s.notifySubscribers(Event{
|
||||||
ID: t.ID,
|
ID: t.ID,
|
||||||
|
@ -32,7 +32,7 @@ func (s *Supervisor) updateContainer(t *UpdateTask) error {
|
||||||
})
|
})
|
||||||
case runtime.Paused:
|
case runtime.Paused:
|
||||||
if err := container.Pause(); err != nil {
|
if err := container.Pause(); err != nil {
|
||||||
return ErrUnknownContainerStatus
|
return err
|
||||||
}
|
}
|
||||||
s.notifySubscribers(Event{
|
s.notifySubscribers(Event{
|
||||||
ID: t.ID,
|
ID: t.ID,
|
||||||
|
|
Loading…
Reference in a new issue