summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpod/util.go b/libpod/util.go
index 13235059f..17325f6e4 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -145,3 +145,18 @@ func sortMounts(m []spec.Mount) []spec.Mount {
sort.Sort(byDestination(m))
return m
}
+
+func validPodNSOption(p *Pod, ctrPod string) error {
+ if p == nil {
+ return errors.Wrapf(ErrInvalidArg, "pod passed in was nil. Container may not be associated with a pod")
+ }
+
+ if ctrPod == "" {
+ return errors.Wrapf(ErrInvalidArg, "container is not a member of any pod")
+ }
+
+ if ctrPod != p.ID() {
+ return errors.Wrapf(ErrInvalidArg, "pod passed in is not the pod the container is associated with")
+ }
+ return nil
+}