vars: move overeager cache invalidation after one generator closure is regenrated.

Invalidation doesn't need to be done after each generator is executed.
We cannot interpolate values from other generators into another
generator. The generators are executed in order. The finalScript of each
generator stays constant.
After the complete closure is generated the caller of generate may
decide to invalidate the flake cache
This commit is contained in:
Johannes Kirschbauer
2025-04-22 16:42:21 +02:00
parent fe0d39bf11
commit dc284e1c40

View File

@@ -266,8 +266,6 @@ def execute_generator(
machine.flake_dir,
f"Update vars via generator {generator.name} for machine {machine.name}",
)
if len(files_to_commit) > 0:
machine.flush_caches()
def _ask_prompts(
@@ -526,7 +524,11 @@ def generate_command(args: argparse.Namespace) -> None:
f"clanInternals.machines.{system}.{{{','.join(machine_names)}}}.config.system.clan.deployment.file",
]
)
generate_vars(machines, args.generator, args.regenerate, no_sandbox=args.no_sandbox)
has_changed = generate_vars(
machines, args.generator, args.regenerate, no_sandbox=args.no_sandbox
)
if has_changed:
args.flake.invalidate_cache()
def register_generate_parser(parser: argparse.ArgumentParser) -> None: