summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-28 09:11:19 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-29 01:27:40 +0000
commitecda694a92242e6e6921d42b52847bb909eb8051 (patch)
tree7a73cc7f3b82047b7ce4466f9adec1a9089eff3f
parent5b6f59e36cc68bf5bb2e0bd363fe005b55bf0c8f (diff)
downloadpodman-ecda694a92242e6e6921d42b52847bb909eb8051.tar.gz
podman-ecda694a92242e6e6921d42b52847bb909eb8051.tar.bz2
podman-ecda694a92242e6e6921d42b52847bb909eb8051.zip
Ensure container dependencies are part of the same pod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #558 Approved by: rhatdan
-rw-r--r--libpod/boltdb_state_internal.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index fc175fc1f..25dd216a3 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -413,6 +413,10 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error {
if depCtrPod == nil {
return errors.Wrapf(ErrInvalidArg, "container %s depends on container %s which is not in pod %s", ctr.ID(), dependsCtr, pod.ID())
}
+
+ if string(depCtrPod) != pod.ID() {
+ return errors.Wrapf(ErrInvalidArg, "container %s depends on container %s which is in a different pod (%s)", ctr.ID(), dependsCtr, string(depCtrPod))
+ }
} else {
// If we're not part of a pod, we cannot depend on containets in a pod
if depCtrPod != nil {