-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate containers in dependency order #1444
Conversation
bf2028c
to
3fae80b
Compare
3fae80b
to
7714675
Compare
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This fixes a bug where migration would fail with an error if a downstream container was migrated before its upstream dependencies, due to `check_for_legacy_containers()` being implicitly called when we fetch `links`, `volumes_from` or `net` dependencies. Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
7714675
to
7da8e6b
Compare
containers = client.containers(all=stopped) | ||
|
||
for service in services: | ||
for container in containers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so if I understand this correctly, the change here is that now we're iterating over things in the order of the passed in services, instead of just the container list order (which is basically undefined).
We have to assume the services were passed in the correct order, but that's probably safe to assume, since that's how we store them generally.
Does that sound right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry, the actual fix is a bit subtle - it relies on the fact that Project
keeps its services in order, and so project.service_names
returns them in order. That's a widely relied-upon constraint, though, so I don't think this is brittle.
LGTM |
Migrate containers in dependency order
Sits on top of #1441.
This fixes a bug introduced by #1441 where migration would fail with an error if a downstream container was migrated before its upstream dependencies (e.g. web before db), due to
check_for_legacy_containers()
being implicitly called when we fetchlinks
,volumes_from
ornet
dependencies.