mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2025-12-27 11:06:35 +00:00
- Replace legacy standalone scripts with a proper src-layout Python package (baudolo backup/restore/configure entrypoints via pyproject.toml) - Remove old scripts/files (backup-docker-to-local.py, recover-docker-from-local.sh, databases.csv.tpl, Todo.md) - Add Dockerfile to build the project image for local/E2E usage - Update Makefile: build image and run E2E via external runner script - Add scripts/test-e2e.sh: - start DinD + dedicated network - recreate DinD data volume (and shared /tmp volume) - pre-pull helper images (alpine-rsync, alpine) - load local baudolo:local image into DinD - run unittest E2E suite inside DinD and abort on first failure - on failure: dump host+DinD diagnostics and archive shared /tmp into artifacts/ - Add artifacts/ debug outputs produced by failing E2E runs (logs, events, tmp archive) https://chatgpt.com/share/694ec23f-0794-800f-9a59-8365bc80f435
27 lines
738 B
Python
27 lines
738 B
Python
from __future__ import annotations
|
|
|
|
import subprocess
|
|
|
|
|
|
class BackupException(Exception):
|
|
"""Generic exception for backup errors."""
|
|
|
|
|
|
def execute_shell_command(command: str) -> list[str]:
|
|
"""Execute a shell command and return its output lines."""
|
|
print(command, flush=True)
|
|
process = subprocess.Popen(
|
|
[command],
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.PIPE,
|
|
shell=True,
|
|
)
|
|
out, err = process.communicate()
|
|
if process.returncode != 0:
|
|
raise BackupException(
|
|
f"Error in command: {command}\n"
|
|
f"Output: {out}\nError: {err}\n"
|
|
f"Exit code: {process.returncode}"
|
|
)
|
|
return [line.decode("utf-8") for line in out.splitlines()]
|