|
|
@ -60,6 +60,7 @@ from podman_compose_tools.executor import (
|
|
|
|
CompletedExec,
|
|
|
|
CompletedExec,
|
|
|
|
ExecutorTarget,
|
|
|
|
ExecutorTarget,
|
|
|
|
HostExecutor,
|
|
|
|
HostExecutor,
|
|
|
|
|
|
|
|
ShellCommand,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from podman_compose_tools.executor.base import (
|
|
|
|
from podman_compose_tools.executor.base import (
|
|
|
|
combine_cmds,
|
|
|
|
combine_cmds,
|
|
|
@ -137,6 +138,11 @@ def parse_bool(val: str | bool) -> bool:
|
|
|
|
# === code
|
|
|
|
# === code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# required because of mypy attrs converter restrictions
|
|
|
|
|
|
|
|
def shell_cmd_from_str(command: str) -> ShellCommand:
|
|
|
|
|
|
|
|
return ShellCommand.from_str(command=command)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@define(kw_only=True)
|
|
|
|
@define(kw_only=True)
|
|
|
|
class VolumeBackupConfig:
|
|
|
|
class VolumeBackupConfig:
|
|
|
|
# === Backups
|
|
|
|
# === Backups
|
|
|
@ -145,12 +151,24 @@ class VolumeBackupConfig:
|
|
|
|
image: str = field(default=DEFAULT_BACKUP_IMAGE)
|
|
|
|
image: str = field(default=DEFAULT_BACKUP_IMAGE)
|
|
|
|
mount_target: str = field(default=DEFAULT_MOUNT_TARGET)
|
|
|
|
mount_target: str = field(default=DEFAULT_MOUNT_TARGET)
|
|
|
|
stop: bool = field(converter=parse_bool, default=False)
|
|
|
|
stop: bool = field(converter=parse_bool, default=False)
|
|
|
|
backup_cmd: str = field(default=DEFAULT_BACKUP_CMD)
|
|
|
|
backup_cmd: ShellCommand = field(
|
|
|
|
restore_cmd: str = field(default=DEFAULT_RESTORE_CMD)
|
|
|
|
converter=shell_cmd_from_str,
|
|
|
|
|
|
|
|
default=shell_cmd_from_str(DEFAULT_BACKUP_CMD),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
restore_cmd: ShellCommand = field(
|
|
|
|
|
|
|
|
converter=shell_cmd_from_str,
|
|
|
|
|
|
|
|
default=shell_cmd_from_str(DEFAULT_RESTORE_CMD),
|
|
|
|
|
|
|
|
)
|
|
|
|
# === Compressing
|
|
|
|
# === Compressing
|
|
|
|
compress_image: Optional[str] = field(default=None)
|
|
|
|
compress_image: Optional[str] = field(default=None)
|
|
|
|
compress_cmd: Optional[str] = field(default=None)
|
|
|
|
compress_cmd: Optional[ShellCommand] = field(
|
|
|
|
decompress_cmd: Optional[str] = field(default=None)
|
|
|
|
converter=shell_cmd_from_str,
|
|
|
|
|
|
|
|
default=None,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
decompress_cmd: Optional[ShellCommand] = field(
|
|
|
|
|
|
|
|
converter=shell_cmd_from_str,
|
|
|
|
|
|
|
|
default=None,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def from_labels(cls, labels: LabelDict) -> VolumeBackupConfig:
|
|
|
|
def from_labels(cls, labels: LabelDict) -> VolumeBackupConfig:
|
|
|
|