diff options
author | Matthew Heon <mheon@redhat.com> | 2018-03-27 10:07:06 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-27 14:46:17 +0000 |
commit | 26d7e3c7b85e28c4e42998c90fdcc14079f13eef (patch) | |
tree | b5f29ad6e00b832bb13b072e11db6ba5187601c8 /libpod | |
parent | 304bf53c28301a8dfd126f2304e02df5472e56b1 (diff) | |
download | podman-26d7e3c7b85e28c4e42998c90fdcc14079f13eef.tar.gz podman-26d7e3c7b85e28c4e42998c90fdcc14079f13eef.tar.bz2 podman-26d7e3c7b85e28c4e42998c90fdcc14079f13eef.zip |
Fix some minor issues lint has been picking up
Signed-off-by: Matthew Heon <mheon@redhat.com>
Closes: #556
Approved by: baude
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container.go | 10 | ||||
-rw-r--r-- | libpod/container_inspect.go | 12 | ||||
-rw-r--r-- | libpod/image/image.go | 3 | ||||
-rw-r--r-- | libpod/runtime_img.go | 4 |
4 files changed, 17 insertions, 12 deletions
diff --git a/libpod/container.go b/libpod/container.go index 98810ea94..c2b07eb3f 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -743,10 +743,12 @@ func (c *Container) BindMounts() (map[string]string, error) { // NamespacePath returns the path of one of the container's namespaces // If the container is not running, an error will be returned func (c *Container) NamespacePath(ns LinuxNS) (string, error) { - c.lock.Lock() - defer c.lock.Unlock() - if err := c.syncContainer(); err != nil { - return "", errors.Wrapf(err, "error updating container %s state", c.ID()) + if !c.locked { + c.lock.Lock() + defer c.lock.Unlock() + if err := c.syncContainer(); err != nil { + return "", errors.Wrapf(err, "error updating container %s state", c.ID()) + } } if c.state.State != ContainerStateRunning && c.state.State != ContainerStatePaused { diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go index bbfcd4446..0fdce13c0 100644 --- a/libpod/container_inspect.go +++ b/libpod/container_inspect.go @@ -30,18 +30,18 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data) } resolvPath := "" - if path, ok := c.state.BindMounts["/etc/resolv.conf"]; ok { - resolvPath = path + if getPath, ok := c.state.BindMounts["/etc/resolv.conf"]; ok { + resolvPath = getPath } hostsPath := "" - if path, ok := c.state.BindMounts["/etc/hosts"]; ok { - hostsPath = path + if getPath, ok := c.state.BindMounts["/etc/hosts"]; ok { + hostsPath = getPath } hostnamePath := "" - if path, ok := c.state.BindMounts["/etc/hostname"]; ok { - hostnamePath = path + if getPath, ok := c.state.BindMounts["/etc/hostname"]; ok { + hostnamePath = getPath } data := &inspect.ContainerInspectData{ diff --git a/libpod/image/image.go b/libpod/image/image.go index 22268ac45..5413c4e6b 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -143,6 +143,9 @@ func (ir *Runtime) New(name, signaturePolicyPath, authfile string, writer io.Wri newImage.InputName = imageName img, err := newImage.getLocalImage() + if err != nil { + return nil, errors.Wrapf(err, "error retrieving local image after pulling %s", name) + } newImage.image = img return &newImage, nil } diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index 215c0afed..b891fcde9 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -98,11 +98,11 @@ func (r *Runtime) RemoveImage(image *image.Image, force bool) (string, error) { if force { for _, ctr := range imageCtrs { if err := r.removeContainer(ctr, true); err != nil { - return "", errors.Wrapf(err, "error removing image %s: container %s using image could not be removed", image.ID, ctr.ID()) + return "", errors.Wrapf(err, "error removing image %s: container %s using image could not be removed", image.ID(), ctr.ID()) } } } else { - return "", fmt.Errorf("could not remove image %s as it is being used by %d containers", image.ID, len(imageCtrs)) + return "", fmt.Errorf("could not remove image %s as it is being used by %d containers", image.ID(), len(imageCtrs)) } } |