enable ASYNC, DTZ, YTT and EM lints

This commit is contained in:
Jörg Thalheim
2024-09-02 13:55:46 +02:00
parent d4d7085397
commit e150b37fb8
98 changed files with 526 additions and 421 deletions

View File

@@ -22,24 +22,28 @@ def create_backup(machine: Machine, provider: str | None = None) -> None:
[backup_scripts["providers"][provider]["create"]],
)
if proc.returncode != 0:
raise ClanError("failed to start backup")
msg = "failed to start backup"
raise ClanError(msg)
else:
print("successfully started backup")
else:
if provider not in backup_scripts["providers"]:
raise ClanError(f"provider {provider} not found")
msg = f"provider {provider} not found"
raise ClanError(msg)
proc = machine.target_host.run(
[backup_scripts["providers"][provider]["create"]],
)
if proc.returncode != 0:
raise ClanError("failed to start backup")
msg = "failed to start backup"
raise ClanError(msg)
else:
print("successfully started backup")
def create_command(args: argparse.Namespace) -> None:
if args.flake is None:
raise ClanError("Could not find clan flake toplevel directory")
msg = "Could not find clan flake toplevel directory"
raise ClanError(msg)
machine = Machine(name=args.machine, flake=args.flake)
create_backup(machine=machine, provider=args.provider)

View File

@@ -54,7 +54,8 @@ def list_backups(machine: Machine, provider: str | None = None) -> list[Backup]:
def list_command(args: argparse.Namespace) -> None:
if args.flake is None:
raise ClanError("Could not find clan flake toplevel directory")
msg = "Could not find clan flake toplevel directory"
raise ClanError(msg)
machine = Machine(name=args.machine, flake=args.flake)
backups = list_backups(machine=machine, provider=args.provider)
for backup in backups:

View File

@@ -32,9 +32,8 @@ def restore_service(machine: Machine, name: str, provider: str, service: str) ->
extra_env=env,
)
if proc.returncode != 0:
raise ClanError(
f"failed to run preRestoreCommand: {pre_restore}, error was: {proc.stdout}"
)
msg = f"failed to run preRestoreCommand: {pre_restore}, error was: {proc.stdout}"
raise ClanError(msg)
proc = machine.target_host.run(
[backup_metadata["providers"][provider]["restore"]],
@@ -42,9 +41,8 @@ def restore_service(machine: Machine, name: str, provider: str, service: str) ->
extra_env=env,
)
if proc.returncode != 0:
raise ClanError(
f"failed to restore backup: {backup_metadata['providers'][provider]['restore']}"
)
msg = f"failed to restore backup: {backup_metadata['providers'][provider]['restore']}"
raise ClanError(msg)
if post_restore := backup_folders[service]["postRestoreCommand"]:
proc = machine.target_host.run(
@@ -53,9 +51,8 @@ def restore_service(machine: Machine, name: str, provider: str, service: str) ->
extra_env=env,
)
if proc.returncode != 0:
raise ClanError(
f"failed to run postRestoreCommand: {post_restore}, error was: {proc.stdout}"
)
msg = f"failed to run postRestoreCommand: {post_restore}, error was: {proc.stdout}"
raise ClanError(msg)
def restore_backup(
@@ -85,7 +82,8 @@ def restore_backup(
def restore_command(args: argparse.Namespace) -> None:
if args.flake is None:
raise ClanError("Could not find clan flake toplevel directory")
msg = "Could not find clan flake toplevel directory"
raise ClanError(msg)
machine = Machine(name=args.machine, flake=args.flake)
restore_backup(
machine=machine,