containers / containers/podman-py

[BUG] Getting a network by ID does not work

Open
#584 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
381
Forks
140
Avg merge
5h 30m
Merged PRs (30d)
1

Description

See repro test [here](https://github.com/nlacasse/podman-py/commit/856b3690d0cd79b6c3935722ae9930c84ed157f6).

When we create a new network, podman returns its `id`. However, the [`Network.id`](https://github.com/containers/podman-py/blob/main/podman/domain/networks.py#L31-L40) method tries to return `self.attrs["Id"]`, but that always fails, so it falls back to returing a synthetic `id` based on the network name. If we pass this `id` to `network.get()`, the call fails, since Podman does not know any networks with that id.

Lowercasing `Id` -> `id` in [this line](https://github.com/containers/podman-py/blob/main/podman/domain/networks.py#L34) fixes the issue, and causes `Network.id` to return the correct `id` assiged by Podman. But I'm not sure if that's the correct fix.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.