summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi
diff options
context:
space:
mode:
authorhaircommander <pehunt@redhat.com>2018-08-14 17:16:22 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-16 20:31:50 +0000
commit8d5e0108d7c8b69abb9821bfe55475ae5d663b3a (patch)
tree6d8fa9c82a9181fad919bd797f64fe46440e7a4e /pkg/varlinkapi
parent0059989783851ec536faf8a290eea863148dcb6c (diff)
downloadpodman-8d5e0108d7c8b69abb9821bfe55475ae5d663b3a.tar.gz
podman-8d5e0108d7c8b69abb9821bfe55475ae5d663b3a.tar.bz2
podman-8d5e0108d7c8b69abb9821bfe55475ae5d663b3a.zip
Change batchcontainer to shared
To better reflect it's usage: to share functions between podman and varlink. Signed-off-by: haircommander <pehunt@redhat.com> Closes: #1275 Approved by: mheon
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r--pkg/varlinkapi/containers.go12
-rw-r--r--pkg/varlinkapi/pods.go6
-rw-r--r--pkg/varlinkapi/util.go14
3 files changed, 16 insertions, 16 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index df8b66996..58452716a 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -9,7 +9,7 @@ import (
"syscall"
"time"
- "github.com/containers/libpod/cmd/podman/batchcontainer"
+ "github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/cmd/podman/varlink"
"github.com/containers/libpod/libpod"
"github.com/containers/storage/pkg/archive"
@@ -26,12 +26,12 @@ func (i *LibpodAPI) ListContainers(call iopodman.VarlinkCall) error {
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
- opts := batchcontainer.PsOptions{
+ opts := shared.PsOptions{
Namespace: true,
Size: true,
}
for _, ctr := range containers {
- batchInfo, err := batchcontainer.BatchContainerOp(ctr, opts)
+ batchInfo, err := shared.BatchContainerOp(ctr, opts)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
@@ -47,11 +47,11 @@ func (i *LibpodAPI) GetContainer(call iopodman.VarlinkCall, name string) error {
if err != nil {
return call.ReplyContainerNotFound(name)
}
- opts := batchcontainer.PsOptions{
+ opts := shared.PsOptions{
Namespace: true,
Size: true,
}
- batchInfo, err := batchcontainer.BatchContainerOp(ctr, opts)
+ batchInfo, err := shared.BatchContainerOp(ctr, opts)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
@@ -68,7 +68,7 @@ func (i *LibpodAPI) InspectContainer(call iopodman.VarlinkCall, name string) err
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
- data, err := batchcontainer.GetCtrInspectInfo(ctr, inspectInfo)
+ data, err := shared.GetCtrInspectInfo(ctr, inspectInfo)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go
index 272c348fc..98a622d8a 100644
--- a/pkg/varlinkapi/pods.go
+++ b/pkg/varlinkapi/pods.go
@@ -4,7 +4,7 @@ import (
"encoding/json"
"syscall"
- "github.com/projectatomic/libpod/cmd/podman/batchcontainer"
+ "github.com/projectatomic/libpod/cmd/podman/shared"
"github.com/projectatomic/libpod/cmd/podman/varlink"
"github.com/projectatomic/libpod/libpod"
)
@@ -40,7 +40,7 @@ func (i *LibpodAPI) ListPods(call iopodman.VarlinkCall) error {
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
- opts := batchcontainer.PsOptions{}
+ opts := shared.PsOptions{}
for _, pod := range pods {
listPod, err := makeListPod(pod, opts)
if err != nil {
@@ -57,7 +57,7 @@ func (i *LibpodAPI) GetPod(call iopodman.VarlinkCall, name string) error {
if err != nil {
return call.ReplyPodNotFound(name)
}
- opts := batchcontainer.PsOptions{}
+ opts := shared.PsOptions{}
listPod, err := makeListPod(pod, opts)
if err != nil {
diff --git a/pkg/varlinkapi/util.go b/pkg/varlinkapi/util.go
index 74afabd0f..e0b679934 100644
--- a/pkg/varlinkapi/util.go
+++ b/pkg/varlinkapi/util.go
@@ -5,7 +5,7 @@ import (
"strconv"
"time"
- "github.com/containers/libpod/cmd/podman/batchcontainer"
+ "github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/cmd/podman/varlink"
"github.com/containers/libpod/libpod"
)
@@ -15,12 +15,12 @@ func getContext() context.Context {
return context.TODO()
}
-func makeListContainer(containerID string, batchInfo batchcontainer.BatchContainerStruct) iopodman.ListContainerData {
+func makeListContainer(containerID string, batchInfo shared.BatchContainerStruct) iopodman.ListContainerData {
var (
mounts []iopodman.ContainerMount
ports []iopodman.ContainerPortMappings
)
- ns := batchcontainer.GetNamespaces(batchInfo.Pid)
+ ns := shared.GetNamespaces(batchInfo.Pid)
for _, mount := range batchInfo.ConConfig.Spec.Mounts {
m := iopodman.ContainerMount{
@@ -78,7 +78,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain
return lc
}
-func makeListPodContainers(containerID string, batchInfo batchcontainer.BatchContainerStruct) iopodman.ListPodContainerInfo {
+func makeListPodContainers(containerID string, batchInfo shared.BatchContainerStruct) iopodman.ListPodContainerInfo {
lc := iopodman.ListPodContainerInfo{
Id: containerID,
Status: batchInfo.ConState.String(),
@@ -87,10 +87,10 @@ func makeListPodContainers(containerID string, batchInfo batchcontainer.BatchCon
return lc
}
-func makeListPod(pod *libpod.Pod, batchInfo batchcontainer.PsOptions) (iopodman.ListPodData, error) {
+func makeListPod(pod *libpod.Pod, batchInfo shared.PsOptions) (iopodman.ListPodData, error) {
var listPodsContainers []iopodman.ListPodContainerInfo
var errPodData = iopodman.ListPodData{}
- status, err := pod.Status()
+ status, err := shared.GetPodStatus(pod)
if err != nil {
return errPodData, err
}
@@ -99,7 +99,7 @@ func makeListPod(pod *libpod.Pod, batchInfo batchcontainer.PsOptions) (iopodman.
return errPodData, err
}
for _, ctr := range containers {
- batchInfo, err := batchcontainer.BatchContainerOp(ctr, batchInfo)
+ batchInfo, err := shared.BatchContainerOp(ctr, batchInfo)
if err != nil {
return errPodData, err
}