fix(network-manager): handle null IPAM.Config in _subnet_in_use#33
Open
fix(network-manager): handle null IPAM.Config in _subnet_in_use#33
Conversation
Some Docker networks (created without an address pool) have IPAM.Config
set to explicit null rather than omitted. `.get("Config", [])` returns
None in that case, blowing up the iteration with
'NoneType' object is not iterable
and leaving subnet-in-use detection broken — the mock would then
happily allocate a subnet that's already taken.
Switch to `.get("Config") or []` so the fallback kicks in for both
missing and null.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Docker networks created without an address pool have `IPAM.Config` set
to explicit `null`. `.get("Config", [])` returns `None` in that case,
which blows up the subsequent iteration with `'NoneType' object is not
iterable` — the warning fires, `_subnet_in_use` returns `False` by
default, and the mock happily allocates an already-taken subnet.
Swap to `.get("Config") or []` so the fallback kicks in for both
`null` and `missing`.
How it was found
During local harness validation of the Madagascar seed flow. The mock
would warn `Failed to inspect existing Docker subnets: 'NoneType' object
is not iterable` after certain Docker states, and the next seed request
got an intermittent subnet-overlap.
Test plan
NoneType warning.
🤖 Generated with Claude Code