Fix some minor issues lint has been picking up
Signed-off-by: Matthew Heon <mheon@redhat.com> Closes: #556 Approved by: baude
This commit is contained in:
parent
304bf53c28
commit
26d7e3c7b8
|
@ -743,10 +743,12 @@ func (c *Container) BindMounts() (map[string]string, error) {
|
||||||
// NamespacePath returns the path of one of the container's namespaces
|
// NamespacePath returns the path of one of the container's namespaces
|
||||||
// If the container is not running, an error will be returned
|
// If the container is not running, an error will be returned
|
||||||
func (c *Container) NamespacePath(ns LinuxNS) (string, error) {
|
func (c *Container) NamespacePath(ns LinuxNS) (string, error) {
|
||||||
c.lock.Lock()
|
if !c.locked {
|
||||||
defer c.lock.Unlock()
|
c.lock.Lock()
|
||||||
if err := c.syncContainer(); err != nil {
|
defer c.lock.Unlock()
|
||||||
return "", errors.Wrapf(err, "error updating container %s state", c.ID())
|
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 {
|
if c.state.State != ContainerStateRunning && c.state.State != ContainerStatePaused {
|
||||||
|
|
|
@ -30,18 +30,18 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
resolvPath := ""
|
resolvPath := ""
|
||||||
if path, ok := c.state.BindMounts["/etc/resolv.conf"]; ok {
|
if getPath, ok := c.state.BindMounts["/etc/resolv.conf"]; ok {
|
||||||
resolvPath = path
|
resolvPath = getPath
|
||||||
}
|
}
|
||||||
|
|
||||||
hostsPath := ""
|
hostsPath := ""
|
||||||
if path, ok := c.state.BindMounts["/etc/hosts"]; ok {
|
if getPath, ok := c.state.BindMounts["/etc/hosts"]; ok {
|
||||||
hostsPath = path
|
hostsPath = getPath
|
||||||
}
|
}
|
||||||
|
|
||||||
hostnamePath := ""
|
hostnamePath := ""
|
||||||
if path, ok := c.state.BindMounts["/etc/hostname"]; ok {
|
if getPath, ok := c.state.BindMounts["/etc/hostname"]; ok {
|
||||||
hostnamePath = path
|
hostnamePath = getPath
|
||||||
}
|
}
|
||||||
|
|
||||||
data := &inspect.ContainerInspectData{
|
data := &inspect.ContainerInspectData{
|
||||||
|
|
|
@ -143,6 +143,9 @@ func (ir *Runtime) New(name, signaturePolicyPath, authfile string, writer io.Wri
|
||||||
|
|
||||||
newImage.InputName = imageName
|
newImage.InputName = imageName
|
||||||
img, err := newImage.getLocalImage()
|
img, err := newImage.getLocalImage()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrapf(err, "error retrieving local image after pulling %s", name)
|
||||||
|
}
|
||||||
newImage.image = img
|
newImage.image = img
|
||||||
return &newImage, nil
|
return &newImage, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,11 +98,11 @@ func (r *Runtime) RemoveImage(image *image.Image, force bool) (string, error) {
|
||||||
if force {
|
if force {
|
||||||
for _, ctr := range imageCtrs {
|
for _, ctr := range imageCtrs {
|
||||||
if err := r.removeContainer(ctr, true); err != nil {
|
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 {
|
} 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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue