From bc6b4aa39c9156f31a5d370b19e91f42e0f14181 Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 21 Feb 2019 15:12:04 -0600 Subject: podman-remote pod inspect|exists enable the remote client to be able to inspect a pod. also, bonus of enabling the podman pod exists command which returns a 0 or 1 depending on whether the given pod exists. Signed-off-by: baude --- pkg/varlinkapi/pods.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg/varlinkapi/pods.go') diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go index 1dd864d03..2988c5d84 100644 --- a/pkg/varlinkapi/pods.go +++ b/pkg/varlinkapi/pods.go @@ -286,3 +286,20 @@ func (i *LibpodAPI) GetPodsByContext(call iopodman.VarlinkCall, all, latest bool } return call.ReplyGetPodsByContext(podids) } + +// PodStateData returns a container's state data in string format +func (i *LibpodAPI) PodStateData(call iopodman.VarlinkCall, name string) error { + pod, err := i.Runtime.LookupPod(name) + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + data, err := pod.Inspect() + if err != nil { + return call.ReplyErrorOccurred("unable to obtain pod state") + } + b, err := json.Marshal(data) + if err != nil { + return call.ReplyErrorOccurred("unable to serialize pod inspect data") + } + return call.ReplyPodStateData(string(b)) +} -- cgit v1.2.3-54-g00ecf