summaryrefslogtreecommitdiff
path: root/libpod/in_memory_state.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-07-19 12:04:44 -0400
committerMatthew Heon <matthew.heon@gmail.com>2018-07-24 16:12:31 -0400
commit84afa32493335e74d6094c3723c53cf38ac9e6bb (patch)
tree22701e919d6b2ef5437a2dcc29990870fb22f92f /libpod/in_memory_state.go
parent7b30659629deaddafc7fc925d869324ae754c216 (diff)
downloadpodman-84afa32493335e74d6094c3723c53cf38ac9e6bb.tar.gz
podman-84afa32493335e74d6094c3723c53cf38ac9e6bb.tar.bz2
podman-84afa32493335e74d6094c3723c53cf38ac9e6bb.zip
Ensure pods are part of the set namespace when added
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r--libpod/in_memory_state.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go
index 55be89d4c..e323b069c 100644
--- a/libpod/in_memory_state.go
+++ b/libpod/in_memory_state.go
@@ -542,6 +542,10 @@ func (s *InMemoryState) AddPod(pod *Pod) error {
return errors.Wrapf(ErrPodRemoved, "pod %s is not valid and cannot be added", pod.ID())
}
+ if err := s.checkNSMatch(pod.ID(), pod.Namespace()); err != nil {
+ return err
+ }
+
if _, ok := s.pods[pod.ID()]; ok {
return errors.Wrapf(ErrPodExists, "pod with ID %s already exists in state", pod.ID())
}