podman-py
podman-py copied to clipboard
[BUG] Incorrect key used in the Network.containers property
The dictionary query self.attrs["Containers"] at networks.py#L42-L48 seems to be incorrect (also shown below). Using the key "containers" (lower-case "c") fixes the issue.
@property
def containers(self):
"""list[Container]: Returns list of Containers connected to network."""
with suppress(KeyError):
container_manager = ContainersManager(client=self.client)
return [container_manager.get(ident) for ident in self.attrs["Containers"].keys()]
return []
If fixing this issue is truly as simple as changing the key used to be "containers" instead, let me know and I can make a PR (I can also spend some time to look into adding some unit tests for this).
@yusefkarim hey, thanks for picking it up. do you need help with the PR/unit tests?