Refactor(cli): name set_inv_machine back to set_machine

We don't want to leak information about our internals
Such as 'inv' meaning 'inventory' this is not important from the outside
This commit is contained in:
Johannes Kirschbauer
2025-05-16 17:44:22 +02:00
parent ec22a098e6
commit 64e3d84cab
3 changed files with 6 additions and 6 deletions

View File

@@ -391,7 +391,7 @@ const MachineForm = (props: MachineDetailsProps) => {
return;
}
const machine_response = await callApi("set_inv_machine", {
const machine_response = await callApi("update_machine", {
machine: {
name: props.initialData.machine.name || "My machine",
flake: {

View File

@@ -10,7 +10,7 @@ from clan_cli.machines.machines import Machine
@API.register
def get_inv_machine(machine: Machine) -> InventoryMachine:
def get_machine(machine: Machine) -> InventoryMachine:
inventory_store = InventoryStore(flake=machine.flake)
inventory = inventory_store.read()
@@ -23,7 +23,7 @@ def get_inv_machine(machine: Machine) -> InventoryMachine:
@API.register
def set_inv_machine(machine: Machine, update: InventoryMachine) -> None:
def update_machine(machine: Machine, update: InventoryMachine) -> None:
assert machine.name == update.get("name", machine.name), "Machine name mismatch"
inventory_store = InventoryStore(flake=machine.flake)
inventory = inventory_store.read()

View File

@@ -13,7 +13,7 @@ from clan_lib.persist.inventory_store import InventoryStore
from clan_cli.completions import add_dynamic_completer, complete_tags
from clan_cli.dirs import specific_machine_dir
from clan_cli.machines.hardware import HardwareConfig
from clan_cli.machines.inventory import get_inv_machine
from clan_cli.machines.inventory import get_machine
from clan_cli.machines.machines import Machine
log = logging.getLogger(__name__)
@@ -61,7 +61,7 @@ def query_machines_by_tags(flake: Flake, tags: list[str]) -> dict[str, Machine]:
filtered_machines = {}
for machine in machines.values():
inv_machine = get_inv_machine(machine)
inv_machine = get_machine(machine)
if all(tag in inv_machine["tags"] for tag in tags):
filtered_machines[machine.name] = machine
@@ -88,7 +88,7 @@ def extract_header(c: str) -> str:
@API.register
def get_machine_details(machine: Machine) -> MachineDetails:
machine_inv = get_inv_machine(machine)
machine_inv = get_machine(machine)
hw_config = HardwareConfig.detect_type(machine)
machine_dir = specific_machine_dir(machine)