diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/common/common.go | 28 | ||||
-rw-r--r-- | libpod/container_api.go | 9 | ||||
-rw-r--r-- | libpod/oci.go | 1 |
3 files changed, 8 insertions, 30 deletions
diff --git a/libpod/common/common.go b/libpod/common/common.go index 6af3cd232..932f1f6da 100644 --- a/libpod/common/common.go +++ b/libpod/common/common.go @@ -2,17 +2,9 @@ package common import ( "io" - "strings" - "syscall" cp "github.com/containers/image/copy" "github.com/containers/image/types" - "github.com/pkg/errors" -) - -var ( - // ErrNoPassword is returned if the user did not supply a password - ErrNoPassword = errors.Wrapf(syscall.EINVAL, "password was not supplied") ) // GetCopyOptions constructs a new containers/image/copy.Options{} struct from the given parameters @@ -60,23 +52,3 @@ func IsFalse(str string) bool { func IsValidBool(str string) bool { return IsTrue(str) || IsFalse(str) } - -// ParseRegistryCreds takes a credentials string in the form USERNAME:PASSWORD -// and returns a DockerAuthConfig -func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error) { - if creds == "" { - return nil, errors.New("no credentials supplied") - } - if !strings.Contains(creds, ":") { - return &types.DockerAuthConfig{ - Username: creds, - Password: "", - }, ErrNoPassword - } - v := strings.SplitN(creds, ":", 2) - cfg := &types.DockerAuthConfig{ - Username: v[0], - Password: v[1], - } - return cfg, nil -} diff --git a/libpod/container_api.go b/libpod/container_api.go index 05b3e89e6..3693ab78b 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -313,6 +313,11 @@ func (c *Container) Start() error { return errors.Wrapf(ErrCtrStateInvalid, "container %s must be in Created or Stopped state to be started", c.ID()) } + // TODO remove this when we patch conmon to support restarting containers + if c.state.State == ContainerStateStopped { + return errors.Wrapf(ErrNotImplemented, "restarting a stopped container is not yet supported") + } + // Mount storage for the container if err := c.mountStorage(); err != nil { return err @@ -519,8 +524,8 @@ func (c *Container) Pause() error { if c.state.State == ContainerStatePaused { return errors.Wrapf(ErrCtrStateInvalid, "%q is already paused", c.ID()) } - if c.state.State != ContainerStateRunning && c.state.State != ContainerStateCreated { - return errors.Wrapf(ErrCtrStateInvalid, "%q is not running/created, can't pause", c.state.State) + if c.state.State != ContainerStateRunning { + return errors.Wrapf(ErrCtrStateInvalid, "%q is not running, can't pause", c.state.State) } if err := c.runtime.ociRuntime.pauseContainer(c); err != nil { return err diff --git a/libpod/oci.go b/libpod/oci.go index 278c67829..1fa85bda0 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -394,6 +394,7 @@ func (r *OCIRuntime) startContainer(ctr *Container) error { // killContainer sends the given signal to the given container func (r *OCIRuntime) killContainer(ctr *Container, signal uint) error { + logrus.Debugf("Sending signal %d to container %s", signal, ctr.ID()) if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "kill", ctr.ID(), fmt.Sprintf("%d", signal)); err != nil { return errors.Wrapf(err, "error sending signal to container %s", ctr.ID()) } |