summaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go31
1 files changed, 16 insertions, 15 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index b913857dd..3126ced4c 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -3,6 +3,7 @@ package libpod
import (
"context"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -27,7 +28,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -47,7 +48,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
// If there are no containers without dependencies, we can't start
// Error out
if len(graph.noDepNodes) == 0 {
- return nil, errors.Wrapf(ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
+ return nil, errors.Wrapf(define.ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
}
// Traverse the graph beginning at nodes with no dependencies
@@ -56,7 +57,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error starting some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error starting some containers")
}
defer p.newPodEvent(events.Start)
return nil, nil
@@ -88,7 +89,7 @@ func (p *Pod) StopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -136,7 +137,7 @@ func (p *Pod) StopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error stopping some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error stopping some containers")
}
defer p.newPodEvent(events.Stop)
return nil, nil
@@ -159,7 +160,7 @@ func (p *Pod) Pause() (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -195,7 +196,7 @@ func (p *Pod) Pause() (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error pausing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error pausing some containers")
}
defer p.newPodEvent(events.Pause)
return nil, nil
@@ -218,7 +219,7 @@ func (p *Pod) Unpause() (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -254,7 +255,7 @@ func (p *Pod) Unpause() (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error unpausing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error unpausing some containers")
}
defer p.newPodEvent(events.Unpause)
@@ -279,7 +280,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -299,7 +300,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
// If there are no containers without dependencies, we can't start
// Error out
if len(graph.noDepNodes) == 0 {
- return nil, errors.Wrapf(ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
+ return nil, errors.Wrapf(define.ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
}
// Traverse the graph beginning at nodes with no dependencies
@@ -308,7 +309,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error stopping some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error stopping some containers")
}
p.newPodEvent(events.Stop)
p.newPodEvent(events.Start)
@@ -331,7 +332,7 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -374,7 +375,7 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error killing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error killing some containers")
}
defer p.newPodEvent(events.Kill)
return nil, nil
@@ -387,7 +388,7 @@ func (p *Pod) Status() (map[string]ContainerStatus, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)