Пример #1
0
    def _systemctl(self):
        """
        Setup ``systemd`` unit files in the image.
        """
        if self.systemctl:
            for action in ("enable", "disable", "mask"):
                for unit in self.systemctl.get(action, []):
                    SystemdImage.machine_systemctl(self.image_path, action,
                                                   unit)

        # Clear {image}/etc/machine-id,
        # else subsequent containers get that machine ID.
        machine_id = os.path.join(self.image_path, "etc", "machine-id")
        if os.path.exists(machine_id):
            os.remove(machine_id)