From ecda694a92242e6e6921d42b52847bb909eb8051 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 28 Mar 2018 09:11:19 -0400 Subject: Ensure container dependencies are part of the same pod Signed-off-by: Matthew Heon Closes: #558 Approved by: rhatdan --- libpod/boltdb_state_internal.go | 4 ++++ 1 file changed, 4 insertions(+) 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 { -- cgit v1.2.3-54-g00ecf