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:
@@ -1,6 +1,6 @@
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from clan_cli.vars.generate import Generator
|
||||
@@ -67,16 +67,3 @@ class Var:
|
||||
return f"{self.id}: ********"
|
||||
return f"{self.id}: {self.printable_value}"
|
||||
return f"{self.id}: <not set>"
|
||||
|
||||
@classmethod
|
||||
def from_json(cls: type["Var"], generator_name: str, data: dict[str, Any]) -> "Var":
|
||||
return cls(
|
||||
id=f"{generator_name}/{data['name']}",
|
||||
name=data["name"],
|
||||
secret=data["secret"],
|
||||
deploy=data["deploy"],
|
||||
owner=data.get("owner", "root"),
|
||||
group=data.get("group", "root"),
|
||||
mode=int(data.get("mode", "0400"), 8),
|
||||
needed_for=data.get("neededFor", "services"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user