diff options
author | baude <bbaude@redhat.com> | 2019-04-19 08:33:18 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-05-07 14:06:02 -0500 |
commit | bc7b1ca03da88473c10e59197becd812cf341663 (patch) | |
tree | 13d33a731ca50cd58b71ff7592770ae2afb9807d /pkg/varlinkapi | |
parent | 7b67c9601e1eab6c881ac44503c285c71b0a4a3a (diff) | |
download | podman-bc7b1ca03da88473c10e59197becd812cf341663.tar.gz podman-bc7b1ca03da88473c10e59197becd812cf341663.tar.bz2 podman-bc7b1ca03da88473c10e59197becd812cf341663.zip |
enable integration tests for remote-client
first pass at enabling a swath of integration tests for the
remote-client.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r-- | pkg/varlinkapi/containers.go | 17 | ||||
-rw-r--r-- | pkg/varlinkapi/pods.go | 6 |
2 files changed, 16 insertions, 7 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go index c8be41636..8611a1a7d 100644 --- a/pkg/varlinkapi/containers.go +++ b/pkg/varlinkapi/containers.go @@ -119,6 +119,9 @@ func (i *LibpodAPI) GetContainersByContext(call iopodman.VarlinkCall, all, lates ctrs, err := shortcuts.GetContainersByContext(all, latest, input, i.Runtime) if err != nil { + if errors.Cause(err) == libpod.ErrNoSuchCtr { + return call.ReplyContainerNotFound("", err.Error()) + } return call.ReplyErrorOccurred(err.Error()) } @@ -359,7 +362,11 @@ func (i *LibpodAPI) StartContainer(call iopodman.VarlinkCall, name string) error if state == libpod.ContainerStateRunning || state == libpod.ContainerStatePaused { return call.ReplyErrorOccurred("container is already running or paused") } - if err := ctr.Start(getContext(), false); err != nil { + recursive := false + if ctr.PodID() != "" { + recursive = true + } + if err := ctr.Start(getContext(), recursive); err != nil { return call.ReplyErrorOccurred(err.Error()) } return call.ReplyStartContainer(ctr.ID()) @@ -386,7 +393,13 @@ func (i *LibpodAPI) StopContainer(call iopodman.VarlinkCall, name string, timeou if err != nil { return call.ReplyContainerNotFound(name, err.Error()) } - if err := ctr.StopWithTimeout(uint(timeout)); err != nil && err != libpod.ErrCtrStopped { + if err := ctr.StopWithTimeout(uint(timeout)); err != nil { + if errors.Cause(err) == libpod.ErrCtrStopped { + return call.ReplyErrCtrStopped(ctr.ID()) + } + if errors.Cause(err) == libpod.ErrCtrStateInvalid { + return call.ReplyInvalidState(ctr.ID(), err.Error()) + } return call.ReplyErrorOccurred(err.Error()) } return call.ReplyStopContainer(ctr.ID()) diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go index f34375bf5..c0fd8b1f7 100644 --- a/pkg/varlinkapi/pods.go +++ b/pkg/varlinkapi/pods.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "github.com/containers/libpod/pkg/adapter/shortcuts" - "github.com/containers/libpod/pkg/rootless" "syscall" "github.com/containers/libpod/cmd/podman/shared" @@ -37,12 +36,9 @@ func (i *LibpodAPI) CreatePod(call iopodman.VarlinkCall, create iopodman.PodCrea if !create.Infra { return call.ReplyErrorOccurred("you must have an infra container to publish port bindings to the host") } - if rootless.IsRootless() { - return call.ReplyErrorOccurred("rootless networking does not allow port binding to the host") - } portBindings, err := shared.CreatePortBindings(create.Publish) if err != nil { - return err + return call.ReplyErrorOccurred(err.Error()) } options = append(options, libpod.WithInfraContainerPorts(portBindings)) |