Repository navigation
Fix /pull network reconnect for aliases, static IPs and links - #10
Merged
Merged
Conversation
pull_and_recreate passed each secondary network's endpoint from docker inspect straight to docker-py's Network.connect() as Aliases=, IPAMConfig= and Links=. docker-py only accepts snake_case keywords, so any network with an alias, a static IP or a link failed with "unexpected keyword argument" and was dropped. Only networks with none of those reconnected. - Translate the endpoint to aliases, links (name/alias pairs, which normalize_links() unpacks), ipv4_address, ipv6_address, link_local_ips and driver_opt. Keyword names are checked against the installed connect_container_to_network() signature; anything it lacks is logged and skipped. - Drop the old container's short ID from aliases (engines before API 1.45 list it there) and leave the assigned MAC address unpinned. - Skip a network the recreated container already joined, such as bridge when NetworkMode is "default", instead of reporting a failure. - networks.get() now runs off the event loop like the other Docker calls. The previous test asserted connect(container, Aliases=[...]) on a mock and passed. The new tests drive real docker-py (DockerClient, Network.connect, EndpointConfig) and check the request body for alias, static IPv4 and IPv6, links, driver options, none, the short-ID alias and an assigned MAC.
Adds an Unreleased entry and corrects the 0.22.5 entry, which said a /pull reconnected every secondary network. It reconnected only those with no alias, static IP or link. Version stays at 0.22.5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After /pull the bot recreates a container and reconnects its secondary networks. v0.22.5 passed docker inspect keys (Aliases, IPAMConfig, Links) straight to docker-py, which rejects them, so networks with an alias, static IP or link were dropped.
Now mapped to docker-py's real keywords (read from the installed signature), links converted to (name, alias) pairs, own short id dropped from aliases, already-joined networks skipped.
Tests run real docker-py and fail on a wrong kwarg (1509 pass). Checked in a throwaway container on a Mac Docker: alias, static IP and link survive.
Not checked: older engines, IPv6, link-local or driver_opt against a real engine.
Drafts the 0.22.6 changelog entry only, no version bump.