Feat(inventory): remove legacy action functions

Inventory should only and always be accessed through the inventory store.
Manually reading and writing to the json file is highly insecure
This commit is contained in:
Johannes Kirschbauer
2025-05-27 17:20:04 +02:00
parent 38b83c41cf
commit 3ed3cdddc9
4 changed files with 21 additions and 219 deletions

View File

@@ -21,8 +21,11 @@ log = logging.getLogger(__name__)
@API.register
def delete_machine(machine: Machine) -> None:
inventory_store = inventory.InventoryStore(machine.flake)
try:
inventory.delete(machine.flake, {f"machines.{machine.name}"})
inventory_store.delete(
{f"machines.{machine.name}"},
)
except KeyError as exc:
# louis@(2025-03-09): test infrastructure does not seem to set the
# inventory properly, but more importantly only one machine in my