diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-22 21:12:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-22 21:12:49 +0100 |
commit | c757cb23ca15634077a8b9fa33aba7abd1c8249b (patch) | |
tree | cf98450129274946d9a79d321755d76d115ee3ba /pkg | |
parent | 8039ccf4d560acbc308066cf8996bc4e6167a4a9 (diff) | |
parent | bc6b4aa39c9156f31a5d370b19e91f42e0f14181 (diff) | |
download | podman-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.go | 17 |
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)) +} |