diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-02-10 15:11:32 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-02-12 14:28:07 +0000 |
commit | dc6a99df4c5ea7facaca20129b2b6c5b53ddb3c1 (patch) | |
tree | 0f1915a7e7e296652b0c4aaabc765b5786cfa9ab /libpod/in_memory_state.go | |
parent | 3962d10bd482d1c57707465e8f76e76b4abc9a9f (diff) | |
download | podman-dc6a99df4c5ea7facaca20129b2b6c5b53ddb3c1.tar.gz podman-dc6a99df4c5ea7facaca20129b2b6c5b53ddb3c1.tar.bz2 podman-dc6a99df4c5ea7facaca20129b2b6c5b53ddb3c1.zip |
Containers in a pod can only join namespaces in that pod
This solves some dependency problems in the state, and makes
sense from a design standpoint.
Containers not in a pod can still depend on the namespaces of
containers joined to a pod, which we might also want to change in
the future.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #184
Approved by: baude
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r-- | libpod/in_memory_state.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go index c99a34e7a..a38e080b7 100644 --- a/libpod/in_memory_state.go +++ b/libpod/in_memory_state.go @@ -511,6 +511,9 @@ func (s *InMemoryState) AddContainerToPod(pod *Pod, ctr *Container) error { if _, ok = s.containers[depCtr]; !ok { return errors.Wrapf(ErrNoSuchCtr, "cannot depend on nonexistent container %s", depCtr) } + if _, ok = podCtrs[depCtr]; !ok { + return errors.Wrapf(ErrInvalidArg, "cannot depend on container %s as it is not in pod %s", depCtr, pod.ID()) + } } // Add container to state |