Merge pull request 'vars: make wording nicer when multiple vars are found' (#3351) from push-zrtnwqoxyzmz into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3351
This commit is contained in:
Michael Hoang
2025-04-18 17:28:01 +00:00

View File

@@ -28,10 +28,8 @@ def get_var(base_dir: str, machine_name: str, var_id: str) -> Var:
msg = f"No var found for search string: {var_id}"
raise ClanError(msg)
if len(results) > 1:
error = (
f"Found multiple vars for {var_id}:\n - "
+ "\n - ".join([str(var) for var in results])
+ "\nBe more specific."
error = f"Found multiple vars for {var_id}:\n - " + "\n - ".join(
[str(var) for var in results]
)
raise ClanError(error)
# we have exactly one result at this point