Skip to content

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

@yusefkarim

Description

@yusefkarim

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions