summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-22 21:12:49 +0100
committerGitHub <noreply@github.com>2019-02-22 21:12:49 +0100
commitc757cb23ca15634077a8b9fa33aba7abd1c8249b (patch)
treecf98450129274946d9a79d321755d76d115ee3ba /pkg
parent8039ccf4d560acbc308066cf8996bc4e6167a4a9 (diff)
parentbc6b4aa39c9156f31a5d370b19e91f42e0f14181 (diff)
downloadpodman-c757cb23ca15634077a8b9fa33aba7abd1c8249b.tar.gz
podman-c757cb23ca15634077a8b9fa33aba7abd1c8249b.tar.bz2
podman-c757cb23ca15634077a8b9fa33aba7abd1c8249b.zip
Merge pull request #2402 from baude/remotepodinspect
podman-remote pod inspect|exists
Diffstat (limited to 'pkg')
-rw-r--r--pkg/varlinkapi/pods.go17
1 files changed, 17 insertions, 0 deletions
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))
+}