podman-py icon indicating copy to clipboard operation
podman-py copied to clipboard

[BUG] Incorrect key used in the Network.containers property

Open yusefkarim opened this issue 9 months ago • 1 comments

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 avatar Mar 24 '25 14:03 yusefkarim

@yusefkarim hey, thanks for picking it up. do you need help with the PR/unit tests?

inknos avatar Apr 29 '25 16:04 inknos