diff --git a/pkgs/clan-app/ui-2d/src/components/machine-list-item/index.tsx b/pkgs/clan-app/ui-2d/src/components/machine-list-item/index.tsx index e6c7010af..ae126a11d 100644 --- a/pkgs/clan-app/ui-2d/src/components/machine-list-item/index.tsx +++ b/pkgs/clan-app/ui-2d/src/components/machine-list-item/index.tsx @@ -75,7 +75,7 @@ export const MachineListItem = (props: MachineListItemProps) => { } setInstalling(true); - await callApi("install_machine", { + await callApi("run_machine_install", { opts: { machine: { name: name, @@ -163,7 +163,7 @@ export const MachineListItem = (props: MachineListItemProps) => { } await callApi( - "deploy_machine", + "run_machine_deploy", { machine: { name: name, diff --git a/pkgs/clan-app/ui-2d/src/routes/flash/view.tsx b/pkgs/clan-app/ui-2d/src/routes/flash/view.tsx index e99b5ce93..465e78e3e 100644 --- a/pkgs/clan-app/ui-2d/src/routes/flash/view.tsx +++ b/pkgs/clan-app/ui-2d/src/routes/flash/view.tsx @@ -157,7 +157,7 @@ export const Flash = () => { console.log("Confirmed flash:", values); try { await toast.promise( - callApi("flash_machine", { + callApi("run_machine_flash", { machine: { name: values.machine.devicePath, flake: { diff --git a/pkgs/clan-app/ui-2d/src/routes/machines/components/InstallMachine.tsx b/pkgs/clan-app/ui-2d/src/routes/machines/components/InstallMachine.tsx index 609fa1805..39fed8099 100644 --- a/pkgs/clan-app/ui-2d/src/routes/machines/components/InstallMachine.tsx +++ b/pkgs/clan-app/ui-2d/src/routes/machines/components/InstallMachine.tsx @@ -120,7 +120,7 @@ export function InstallMachine(props: InstallMachineProps) { throw new Error("No target host found for the machine"); } - const installPromise = callApi("install_machine", { + const installPromise = callApi("run_machine_install", { opts: { machine: { name: props.name, diff --git a/pkgs/clan-app/ui-2d/src/routes/machines/components/MachineForm.tsx b/pkgs/clan-app/ui-2d/src/routes/machines/components/MachineForm.tsx index 407321c82..291a2551f 100644 --- a/pkgs/clan-app/ui-2d/src/routes/machines/components/MachineForm.tsx +++ b/pkgs/clan-app/ui-2d/src/routes/machines/components/MachineForm.tsx @@ -149,7 +149,7 @@ export function MachineForm(props: MachineFormProps) { setIsUpdating(true); const r = await callApi( - "deploy_machine", + "run_machine_deploy", { machine: { name: machine, diff --git a/pkgs/clan-cli/clan_cli/flash/flash.py b/pkgs/clan-cli/clan_cli/flash/flash.py index be2eb683e..9f2989ba3 100644 --- a/pkgs/clan-cli/clan_cli/flash/flash.py +++ b/pkgs/clan-cli/clan_cli/flash/flash.py @@ -37,7 +37,7 @@ class Disk: # TODO: unify this with machine install @API.register -def flash_machine( +def run_machine_flash( machine: Machine, *, mode: str, diff --git a/pkgs/clan-cli/clan_cli/flash/flash_cmd.py b/pkgs/clan-cli/clan_cli/flash/flash_cmd.py index 5aba210dc..b0ac95f69 100644 --- a/pkgs/clan-cli/clan_cli/flash/flash_cmd.py +++ b/pkgs/clan-cli/clan_cli/flash/flash_cmd.py @@ -11,7 +11,7 @@ from clan_lib.machines.machines import Machine from clan_cli.completions import add_dynamic_completer, complete_machines -from .flash import Disk, SystemConfig, flash_machine +from .flash import Disk, SystemConfig, run_machine_flash log = logging.getLogger(__name__) @@ -84,7 +84,7 @@ def flash_command(args: argparse.Namespace) -> None: if ask != "y": return - flash_machine( + run_machine_flash( machine, mode=opts.mode, disks=opts.disks, diff --git a/pkgs/clan-cli/clan_cli/machines/install.py b/pkgs/clan-cli/clan_cli/machines/install.py index b93a7331d..d2f04529f 100644 --- a/pkgs/clan-cli/clan_cli/machines/install.py +++ b/pkgs/clan-cli/clan_cli/machines/install.py @@ -4,7 +4,7 @@ import sys from pathlib import Path from clan_lib.errors import ClanError -from clan_lib.machines.install import BuildOn, InstallOptions, install_machine +from clan_lib.machines.install import BuildOn, InstallOptions, run_machine_install from clan_lib.machines.machines import Machine from clan_lib.ssh.remote import Remote @@ -65,7 +65,7 @@ def install_command(args: argparse.Namespace) -> None: if ask != "y": return None - return install_machine( + return run_machine_install( InstallOptions( machine=machine, kexec=args.kexec, diff --git a/pkgs/clan-cli/clan_cli/machines/update.py b/pkgs/clan-cli/clan_cli/machines/update.py index 75c543c8c..5fdaa1f4d 100644 --- a/pkgs/clan-cli/clan_cli/machines/update.py +++ b/pkgs/clan-cli/clan_cli/machines/update.py @@ -9,7 +9,7 @@ from clan_lib.machines.actions import list_machines from clan_lib.machines.list import instantiate_inventory_to_machines from clan_lib.machines.machines import Machine from clan_lib.machines.suggestions import validate_machine_names -from clan_lib.machines.update import deploy_machine +from clan_lib.machines.update import run_machine_deploy from clan_lib.nix import nix_config from clan_lib.ssh.remote import Remote @@ -144,7 +144,7 @@ def update_command(args: argparse.Namespace) -> None: tid=machine.name, async_ctx=AsyncContext(prefix=machine.name), ), - deploy_machine, + run_machine_deploy, machine=machine, target_host=target_host, build_host=machine.build_host(), diff --git a/pkgs/clan-cli/clan_lib/log_manager/example_usage.py b/pkgs/clan-cli/clan_lib/log_manager/example_usage.py index 5460486ca..03c85f727 100755 --- a/pkgs/clan-cli/clan_lib/log_manager/example_usage.py +++ b/pkgs/clan-cli/clan_lib/log_manager/example_usage.py @@ -17,7 +17,7 @@ def example_function() -> None: """Example function for creating logs.""" -def deploy_machine() -> None: +def run_machine_deploy() -> None: """Function for deploying machines.""" @@ -41,7 +41,7 @@ def main() -> None: for repo in repos: for machine in machines: log_manager.create_log_file( - deploy_machine, + run_machine_deploy, f"deploy_{machine}", ["clans", repo, "machines", machine], ) diff --git a/pkgs/clan-cli/clan_lib/log_manager/test_log_manager.py b/pkgs/clan-cli/clan_lib/log_manager/test_log_manager.py index bdd5daa50..49f1c88f8 100644 --- a/pkgs/clan-cli/clan_lib/log_manager/test_log_manager.py +++ b/pkgs/clan-cli/clan_lib/log_manager/test_log_manager.py @@ -17,7 +17,7 @@ from clan_lib.log_manager import ( # Test functions for log creation -def deploy_machine() -> None: +def run_machine_deploy() -> None: """Test function for deploying machines.""" @@ -194,13 +194,13 @@ class TestLogFileCreation: for repo in repos: for machine in machines: log_file = configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, f"deploy_{machine}", ["clans", repo, "machines", machine], ) assert log_file.op_key == f"deploy_{machine}" - assert log_file.func_name == "deploy_machine" + assert log_file.func_name == "run_machine_deploy" assert log_file.get_file_path().exists() # Check the group structure includes URL encoding for dynamic parts @@ -241,7 +241,7 @@ class TestFilterFunction: """Test that empty filter returns top-level groups.""" # Create some log files first configured_log_manager.create_log_file( - deploy_machine, "test_op", ["clans", "repo1", "machines", "machine1"] + run_machine_deploy, "test_op", ["clans", "repo1", "machines", "machine1"] ) top_level = configured_log_manager.filter([]) @@ -258,7 +258,7 @@ class TestFilterFunction: for repo in repos: for machine in machines: configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, f"deploy_{machine}", ["clans", repo, "machines", machine], ) @@ -281,7 +281,7 @@ class TestFilterFunction: """Test filtering with specific date.""" # Create log file log_file = configured_log_manager.create_log_file( - deploy_machine, "test_op", ["clans", "repo1", "machines", "machine1"] + run_machine_deploy, "test_op", ["clans", "repo1", "machines", "machine1"] ) # Filter with the specific date @@ -308,14 +308,16 @@ class TestGetLogFile: """Test getting log file by operation key.""" # Create log file configured_log_manager.create_log_file( - deploy_machine, "deploy_wintux", ["clans", "repo1", "machines", "wintux"] + run_machine_deploy, + "deploy_wintux", + ["clans", "repo1", "machines", "wintux"], ) # Find it by op_key found_log_file = configured_log_manager.get_log_file("deploy_wintux") assert found_log_file is not None assert found_log_file.op_key == "deploy_wintux" - assert found_log_file.func_name == "deploy_machine" + assert found_log_file.func_name == "run_machine_deploy" def test_get_log_file_with_selector( self, configured_log_manager: LogManager @@ -323,10 +325,14 @@ class TestGetLogFile: """Test getting log file with specific selector like example_usage.py.""" # Create log files in different locations configured_log_manager.create_log_file( - deploy_machine, "deploy_wintux", ["clans", "repo1", "machines", "wintux"] + run_machine_deploy, + "deploy_wintux", + ["clans", "repo1", "machines", "wintux"], ) configured_log_manager.create_log_file( - deploy_machine, "deploy_wintux", ["clans", "repo2", "machines", "wintux"] + run_machine_deploy, + "deploy_wintux", + ["clans", "repo2", "machines", "wintux"], ) # Find specific one using selector @@ -341,7 +347,7 @@ class TestGetLogFile: """Test getting log file with specific date.""" # Create log file log_file = configured_log_manager.create_log_file( - deploy_machine, "deploy_demo", ["clans", "repo1", "machines", "demo"] + run_machine_deploy, "deploy_demo", ["clans", "repo1", "machines", "demo"] ) # Find it by op_key and date @@ -378,10 +384,10 @@ class TestListLogDays: """Test listing log days when logs exist.""" # Create log files configured_log_manager.create_log_file( - deploy_machine, "op1", ["clans", "repo1", "machines", "machine1"] + run_machine_deploy, "op1", ["clans", "repo1", "machines", "machine1"] ) configured_log_manager.create_log_file( - deploy_machine, "op2", ["clans", "repo2", "machines", "machine2"] + run_machine_deploy, "op2", ["clans", "repo2", "machines", "machine2"] ) days = configured_log_manager.list_log_days() @@ -406,7 +412,7 @@ class TestApiCompatibility: for repo in repos: for machine in machines: configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, f"deploy_{machine}", ["clans", repo, "machines", machine], ) @@ -741,19 +747,19 @@ class TestLogFileSorting: # This simulates the realistic scenario where the same operation runs on different machines configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, "deploy_operation", ["clans", "repo1", "machines", "machine1"], ) configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, "deploy_operation", ["clans", "repo1", "machines", "machine2"], ) configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, "deploy_operation", ["clans", "repo2", "machines", "machine1"], ) @@ -819,7 +825,7 @@ class TestURLEncoding: # Create log file with special characters log_file = configured_log_manager.create_log_file( - deploy_machine, + run_machine_deploy, "deploy_special", ["clans", special_repo, "machines", special_machine], ) diff --git a/pkgs/clan-cli/clan_lib/machines/install.py b/pkgs/clan-cli/clan_lib/machines/install.py index 66ccf3e0a..ef33e6222 100644 --- a/pkgs/clan-cli/clan_lib/machines/install.py +++ b/pkgs/clan-cli/clan_lib/machines/install.py @@ -39,7 +39,7 @@ class InstallOptions: @API.register -def install_machine(opts: InstallOptions, target_host: Remote) -> None: +def run_machine_install(opts: InstallOptions, target_host: Remote) -> None: machine = opts.machine machine.debug(f"installing {machine.name}") diff --git a/pkgs/clan-cli/clan_lib/machines/update.py b/pkgs/clan-cli/clan_lib/machines/update.py index 9e477562c..62cd98c75 100644 --- a/pkgs/clan-cli/clan_lib/machines/update.py +++ b/pkgs/clan-cli/clan_lib/machines/update.py @@ -103,7 +103,7 @@ def upload_sources(machine: Machine, ssh: Remote) -> str: @API.register -def deploy_machine( +def run_machine_deploy( machine: Machine, target_host: Remote, build_host: Remote | None ) -> None: with ExitStack() as stack: