S101: fix

This commit is contained in:
Jörg Thalheim
2025-08-25 12:26:00 +02:00
parent 332d10e306
commit 6a2dfb8176
8 changed files with 38 additions and 15 deletions

View File

@@ -262,7 +262,9 @@ def add_secret(
def get_groups(flake_dir: Path, what: str, name: str) -> list[str]:
"""Returns the list of group names the given user or machine is part of."""
assert what in {"users", "machines"}
if what not in {"users", "machines"}:
msg = f"Invalid 'what' parameter: {what}. Must be 'users' or 'machines'"
raise ClanError(msg)
groups_dir = sops_groups_folder(flake_dir)
if not groups_dir.exists():

View File

@@ -80,7 +80,9 @@ def migrate_files(
files_to_commit = []
for file in generator.files:
if _migration_file_exists(machine, generator, file.name):
assert generator.migrate_fact is not None
if generator.migrate_fact is None:
msg = f"Generator {generator.name} has no migrate_fact defined"
raise ClanError(msg)
files_to_commit += _migrate_file(
machine,
generator,