summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-04-10 04:24:56 -0700
committerGitHub <noreply@github.com>2019-04-10 04:24:56 -0700
commit2f2c7660c3a30d4c28c03eeeba8edc39f7864c7a (patch)
tree4bfe5f7073420ecb7be8869ee6ee1efc759b36fe /libpod
parent60ef8f8da90ec5200e62b79b24324fefde2c7036 (diff)
parent23cd1928ec36a80f491b329dda3789b2dac32bcc (diff)
downloadpodman-2f2c7660c3a30d4c28c03eeeba8edc39f7864c7a.tar.gz
podman-2f2c7660c3a30d4c28c03eeeba8edc39f7864c7a.tar.bz2
podman-2f2c7660c3a30d4c28c03eeeba8edc39f7864c7a.zip
Merge pull request #2882 from baude/remoteps
podman-remote ps
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