fix: Network.id now returns libpod lowercase 'id', add get_compatible… #660
This removes the uppercase response path that the existing NetworksManager.get test (and Docker-compatible network responses) still use: FIRST_NETWORK has "Id" and "Name", so Network.id now skips both lookups and returns None instead of the network ID. Please retain an Id fallback here (or update every compatible caller/fixture to use the libpod shape) so fetching a compatible network does not lose its identifier.
<!-- ccr-overview-v2 -->
Copilot review overview
🟡 Changes recommended
Restore the uppercase Id fallback and address the requested test coverage and lint issue.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture>
<details open>
<summary><strong>Open (1)</strong></summary>
</details>
<details>
<summary><strong>What changed in this PR</strong></summary>
Updates network ID handling for libpod’s lowercase id format while preserving Docker-compatible IDs for connect().
Changes:
id for Network.id.get_compatible_id() for compatible endpoints.The uppercase Id fallback remains necessary for compatible network responses. Additional lowercase-ID coverage and trailing-whitespace cleanup are also required.
| File | Description |
|---|---|
| podman/tests/unit/test_network.py | Updates network ID tests and adds compatibility coverage. |
| podman/domain/networks.py | Implements libpod and compatible network ID handling. |
</details>
---
💡 <a href="/containers/podman-py/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
The testing-farm:*:distro-fedora-all and testing-farm:fedora-44-x86_64:distro-sanity failures appear to be infrastructure errors unrelated to this change — they error out immediately with "1 plan errored out" and no test output, which is the same pattern seen in other recent PRs. No source logic was modified that would affect distro packaging or sanity checks.
Can you please remove these white spaces?
Should this be private function?
Thanks, I have some comments. Please also add in to commit Fixes: #NUMBER_OF_ISSUE. Thanks!
I've fixed it, removed trailing whitespace.
Made it private (_get_compatible_id)
Hi @Honny1, I've addressed all the review comments — removed trailing whitespace, made the function private (_get_compatible_id), and added Fixes: #584 to the commit. Let me know if there's anything else needed. Thanks!
LGTM
Thanks for the review!
Hi @Honny1, just a heads up your earlier “changes requested” review is still showing as pending on GitHub’s end, which may be blocking the merge. Could you re-review or dismiss the old review when you get a chance? Thanks!
Please rebase on upstream main.
Please rebase on upstream main.
Done, rebased on upstream main.
Hi @Honny1, the two remaining pending checks (rpm-build:fedora-42 and testing-farm:fedora-42) appear to be stuck waiting on Packit infrastructure, they’ve been “Expected Waiting for status to be reported” for 3 days without progress. Could you trigger a retest or override them if they’re not blocking? Thanks!
LGTM
@simek-m Reminder to review.
LGTM
@VincentSamuelPaul, can you please rebase on upstream main? Thanks!
LGTM.
Done, rebased on upstream main. Resolved the conflict in connect() by keeping the upstream implementation which properly handles both libpod and Docker-compatible endpoints.
Honny1
VincentSamuelPaul
Fixes #584
Network.idwas looking forself.attrs["Id"](uppercase), but Podman'slibpod API returns
"id"(lowercase), causing it to always fall back to asynthetic hash-based ID. Passing that fake ID to
networks.get()would then fail.Changes:
Network.idnow correctly readsattrs["id"](libpod format)Added
Network.get_compatible_id()for Docker-compatible endpoints that useattrs["Id"]Network.connect()usesget_compatible_id()since it goes through the Docker-compatible endpointUpdated
test_idto use libpod format, addedtest_compatible_idThis follows the approach suggested by @inknos in #587, analogous to how
Network.namealready handles both"Name"and"name".