INNER CODE UNIT · Python

_get_container_groups

Minituff/nautical-backup · app/backup.py:262

    def _get_container_groups(self, c: Container) -> List[str]:
        """Return the explicit groups a container belongs to via the `group` label.
        Returns an empty list if the container has no group label (i.e. it is not
        part of any user-defined group)."""
        group = str(self.get_label(c, "group", "") or "")
        if not group:
            return []
        return [g.strip() for g in group.split(",") if g.strip()]

    def group_containers(self) -> Dict[str, List[Container]]:
        containers: List[Container] = self.docker.containers.list()  # type: ignore
        starting_container_amt = len(containers)
        self.log_this(f"Processing {starting_container_amt} containers...", "INFO")

        self.db.put("number_of_containers", starting_container_amt)

        output = ""
        for container in containers:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…