summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2019-02-18 16:01:31 -0700
committerJhon Honce <jhonce@redhat.com>2019-03-02 08:57:20 -0700
commit4d13a80fa46ce57e3c889934536320525338b3a4 (patch)
tree8d3d5bd4f0209aa8ce4e3371478e6edc305209e6 /pkg/varlinkapi
parent9adcda73892fa0a33cbdf971ad97cf079e8e425f (diff)
downloadpodman-4d13a80fa46ce57e3c889934536320525338b3a4.tar.gz
podman-4d13a80fa46ce57e3c889934536320525338b3a4.tar.bz2
podman-4d13a80fa46ce57e3c889934536320525338b3a4.zip
Support podman-remote stop container(s)
* Clean up adapter code * Add GetContainersByContext to Varlink API * Add missing comments * Restore save command * Restore error type mapping when using varlink Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r--pkg/varlinkapi/containers.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index ad9f107a7..27b8d15d2 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -13,6 +13,7 @@ import (
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/cmd/podman/varlink"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/pkg/adapter/shortcuts"
cc "github.com/containers/libpod/pkg/spec"
"github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
@@ -60,6 +61,21 @@ func (i *LibpodAPI) GetContainer(call iopodman.VarlinkCall, id string) error {
return call.ReplyGetContainer(makeListContainer(ctr.ID(), batchInfo))
}
+// GetContainersByContext returns a slice of container ids based on all, latest, or a list
+func (i *LibpodAPI) GetContainersByContext(call iopodman.VarlinkCall, all, latest bool, input []string) error {
+ var ids []string
+
+ ctrs, err := shortcuts.GetContainersByContext(all, latest, input, i.Runtime)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+
+ for _, c := range ctrs {
+ ids = append(ids, c.ID())
+ }
+ return call.ReplyGetContainersByContext(ids)
+}
+
// InspectContainer ...
func (i *LibpodAPI) InspectContainer(call iopodman.VarlinkCall, name string) error {
ctr, err := i.Runtime.LookupContainer(name)