refactor: remove _serialized field and implement efficient vars selection

- Remove _serialized field from vars interface to prevent serialization
  errors with throwing passBackend field
- Implement direct selection of generator fields using multi-select syntax
- Refactor vars_generators() to use new Generator.from_flake() method that
  selects only safe fields (avoiding non-serializable values)
- Remove unused legacy methods: Generator.from_json(), Var.from_json(),
  Prompt.from_json()
- Update precaching to match new selection approach

This fixes the serialization errors that were preventing vars from working
with the new password-store implementation by avoiding the problematic
_serialized field entirely.
This commit is contained in:
lassulus
2025-07-02 10:19:54 +02:00
parent 8f9d88a104
commit a6409f921b
7 changed files with 66 additions and 89 deletions

View File

@@ -112,19 +112,7 @@ class Machine:
def vars_generators(self) -> list["Generator"]:
from clan_cli.vars.generate import Generator
try:
generators_data = self.select(
"config.clan.core.vars._serialized.generators"
)
if generators_data is None:
return []
_generators = [Generator.from_json(gen) for gen in generators_data.values()]
for gen in _generators:
gen.machine(self)
except Exception:
return []
else:
return _generators
return Generator.generators_from_flake(self.name, self.flake, self)
@property
def secrets_upload_directory(self) -> str: