summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go6
-rw-r--r--libpod/define/errors.go3
-rw-r--r--libpod/image/pull.go4
-rw-r--r--libpod/runtime_img.go6
4 files changed, 12 insertions, 7 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 50bd9bc25..4cb80a98b 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -19,7 +19,7 @@ import (
"github.com/containers/libpod/pkg/hooks"
"github.com/containers/libpod/pkg/hooks/exec"
"github.com/containers/libpod/pkg/rootless"
- "github.com/containers/libpod/pkg/util"
+ "github.com/containers/libpod/pkg/selinux"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/mount"
@@ -435,12 +435,12 @@ func (c *Container) setupStorage(ctx context.Context) error {
processLabel := containerInfo.ProcessLabel
switch {
case c.ociRuntime.SupportsKVM():
- processLabel, err = util.SELinuxKVMLabel(processLabel)
+ processLabel, err = selinux.SELinuxKVMLabel(processLabel)
if err != nil {
return err
}
case c.config.Systemd:
- processLabel, err = util.SELinuxInitLabel(processLabel)
+ processLabel, err = selinux.SELinuxInitLabel(processLabel)
if err != nil {
return err
}
diff --git a/libpod/define/errors.go b/libpod/define/errors.go
index 3ba343789..16df2a1cc 100644
--- a/libpod/define/errors.go
+++ b/libpod/define/errors.go
@@ -141,4 +141,7 @@ var (
// ErrConmonOutdated indicates the version of conmon found (whether via the configuration or $PATH)
// is out of date for the current podman version
ErrConmonOutdated = errors.New("outdated conmon version")
+
+ // ErrImageInUse indicates the requested operation failed because the image was in use
+ ErrImageInUse = errors.New("image is being used")
)
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index fd359d593..6b4c40ba2 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -334,11 +334,11 @@ func (ir *Runtime) doPullImage(ctx context.Context, sc *types.SystemContext, goa
// If the image passed in was fully-qualified, we will have 1 refpair. Bc the image is fq'd, we don't need to yap about registries.
if !goal.usedSearchRegistries {
if pullErrors != nil && len(pullErrors.Errors) > 0 { // this should always be true
- return nil, errors.Wrap(pullErrors.Errors[0], "unable to pull image")
+ return nil, pullErrors.Errors[0]
}
return nil, errors.Errorf("unable to pull image, or you do not have pull access")
}
- return nil, pullErrors
+ return nil, errors.Cause(pullErrors)
}
if len(images) > 0 {
ir.newImageEvent(events.Pull, images[0])
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 6ac32878b..919080c42 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -71,7 +71,8 @@ func (r *Runtime) RemoveImage(ctx context.Context, img *image.Image, force bool)
// to and untag it.
repoName, err := img.MatchRepoTag(img.InputName)
if hasChildren && errors.Cause(err) == image.ErrRepoTagNotFound {
- return nil, errors.Errorf("unable to delete %q (cannot be forced) - image has dependent child images", img.ID())
+ return nil, errors.Wrapf(define.ErrImageInUse,
+ "unable to delete %q (cannot be forced) - image has dependent child images", img.ID())
}
if err != nil {
return nil, err
@@ -84,7 +85,8 @@ func (r *Runtime) RemoveImage(ctx context.Context, img *image.Image, force bool)
} else if len(img.Names()) > 1 && img.InputIsID() && !force {
// If the user requests to delete an image by ID and the image has multiple
// reponames and no force is applied, we error out.
- return nil, fmt.Errorf("unable to delete %s (must force) - image is referred to in multiple tags", img.ID())
+ return nil, errors.Wrapf(define.ErrImageInUse,
+ "unable to delete %s (must force) - image is referred to in multiple tags", img.ID())
}
err = img.Remove(ctx, force)
if err != nil && errors.Cause(err) == storage.ErrImageUsedByContainer {