From 23cd1928ec36a80f491b329dda3789b2dac32bcc Mon Sep 17 00:00:00 2001 From: baude Date: Tue, 9 Apr 2019 13:07:27 -0500 Subject: podman-remote ps add the ability to run ps on containers using the remote client. Signed-off-by: baude --- libpod/container.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libpod/container.go') 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 -- cgit v1.2.3-54-g00ecf