summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-04-09 13:07:27 -0500
committerbaude <bbaude@redhat.com>2019-04-09 15:00:35 -0500
commit23cd1928ec36a80f491b329dda3789b2dac32bcc (patch)
treec52ef533642c22cb3483790afe57e810ac615112 /libpod
parentfe79bdd07e140176dc64ebef8da3eea2ae28b96b (diff)
downloadpodman-23cd1928ec36a80f491b329dda3789b2dac32bcc.tar.gz
podman-23cd1928ec36a80f491b329dda3789b2dac32bcc.tar.bz2
podman-23cd1928ec36a80f491b329dda3789b2dac32bcc.zip
podman-remote ps
add the ability to run ps on containers using the remote client. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 6d5e063ab..523e571b1 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -401,6 +401,29 @@ func (t ContainerStatus) String() string {
return "bad state"
}
+// StringToContainerStatus converts a string representation of a containers
+// status into an actual container status type
+func StringToContainerStatus(status string) (ContainerStatus, error) {
+ switch status {
+ case ContainerStateUnknown.String():
+ return ContainerStateUnknown, nil
+ case ContainerStateConfigured.String():
+ return ContainerStateConfigured, nil
+ case ContainerStateCreated.String():
+ return ContainerStateCreated, nil
+ case ContainerStateRunning.String():
+ return ContainerStateRunning, nil
+ case ContainerStateStopped.String():
+ return ContainerStateStopped, nil
+ case ContainerStatePaused.String():
+ return ContainerStatePaused, nil
+ case ContainerStateExited.String():
+ return ContainerStateExited, nil
+ default:
+ return ContainerStateUnknown, errors.Wrapf(ErrInvalidArg, "unknown container state: %s", status)
+ }
+}
+
// Config accessors
// Unlocked