Refactor: rename api set_inv_machine parameter to 'machines,update'

This commit is contained in:
Johannes Kirschbauer
2025-05-16 17:10:56 +02:00
parent 1bcf5a82a6
commit e4a6cbc7e3
2 changed files with 4 additions and 4 deletions

View File

@@ -398,7 +398,7 @@ const MachineForm = (props: MachineDetailsProps) => {
identifier: curr_uri, identifier: curr_uri,
}, },
}, },
inventory_machine: { update: {
...values.machine, ...values.machine,
// TODO: Remove this workaround // TODO: Remove this workaround
tags: Array.from( tags: Array.from(

View File

@@ -23,12 +23,12 @@ def get_inv_machine(machine: Machine) -> InventoryMachine:
@API.register @API.register
def set_inv_machine(machine: Machine, inventory_machine: InventoryMachine) -> None: def set_inv_machine(machine: Machine, update: InventoryMachine) -> None:
assert machine.name == inventory_machine["name"], "Machine name mismatch" assert machine.name == update.get("name", machine.name), "Machine name mismatch"
inventory_store = InventoryStore(flake=machine.flake) inventory_store = InventoryStore(flake=machine.flake)
inventory = inventory_store.read() inventory = inventory_store.read()
apply_patch(inventory, f"machines.{machine.name}", inventory_machine) apply_patch(inventory, f"machines.{machine.name}", update)
inventory_store.write( inventory_store.write(
inventory, message=f"Update information about machine {machine.name}" inventory, message=f"Update information about machine {machine.name}"
) )