refactor: reduce coupling to Machine class in vars module

- Change Generator class to store machine name as string instead of Machine reference
- Update Generator.generators_from_flake() to only require machine name and flake
- Refactor check_vars() to accept machine name and flake instead of Machine object
- Create Machine instances only when needed for specific operations

This continues the effort to reduce dependencies on the Machine class,
making the codebase more modular and easier to refactor.
This commit is contained in:
DavHau
2025-07-05 15:54:37 +07:00
parent 3d2ede9f8e
commit bfc8c4c399
9 changed files with 50 additions and 61 deletions

View File

@@ -93,9 +93,7 @@ def flash_machine(
from clan_cli.vars.generate import Generator
for generator in Generator.generators_from_flake(
machine.name, machine.flake, machine
):
for generator in Generator.generators_from_flake(machine.name, machine.flake):
for file in generator.files:
if file.needed_for == "partitioning":
msg = f"Partitioning time secrets are not supported with `clan flash write`: clan.core.vars.generators.{generator.name}.files.{file.name}"