apply TRY lint

This commit is contained in:
Jörg Thalheim
2024-09-03 17:56:59 +02:00
parent 68d777166a
commit 403b9cf2cc
26 changed files with 70 additions and 49 deletions

View File

@@ -200,7 +200,7 @@ def generate_machine_hardware_info(
try:
show_machine_hardware_platform(clan_dir, machine_name)
except ClanCmdError as e:
log.error(e)
log.exception("Failed to evaluate hardware-configuration.nix")
# Restore the backup file
print(f"Restoring backup file {backup_file}")
if backup_file:

View File

@@ -72,10 +72,11 @@ def list_nixos_machines(flake_url: str | Path) -> list[str]:
try:
res = proc.stdout.strip()
data = json.loads(res)
return data
except json.JSONDecodeError as e:
msg = f"Error decoding machines from flake: {e}"
raise ClanError(msg) from e
else:
return data
@dataclass
@@ -123,10 +124,10 @@ def check_machine_online(
proc = run_no_stdout(cmd)
if proc.returncode != 0:
return "Offline"
return "Online"
except ClanCmdError:
return "Offline"
else:
return "Online"
def list_command(args: argparse.Namespace) -> None: