Merge pull request 'api/tasks: prefix impure actions with run' (#4239) from api-cleanup into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4239
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -13,7 +13,6 @@ from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
from typing import IO, Any
|
||||
|
||||
from clan_lib.api import API
|
||||
from clan_lib.cmd import Log, RunOpts, run
|
||||
from clan_lib.dirs import user_config_dir
|
||||
from clan_lib.errors import ClanError
|
||||
@@ -398,7 +397,6 @@ def default_admin_private_key_path() -> Path:
|
||||
return user_config_dir() / "sops" / "age" / "keys.txt"
|
||||
|
||||
|
||||
@API.register
|
||||
def maybe_get_admin_public_keys() -> list[SopsKey] | None:
|
||||
keyring = SopsKey.collect_public_keys()
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ def find_reachable_host(deploy_info: DeployInfo) -> Remote | None:
|
||||
return deploy_info.addrs[0]
|
||||
|
||||
for addr in deploy_info.addrs:
|
||||
if addr.is_ssh_reachable():
|
||||
if addr.check_machine_ssh_reachable():
|
||||
return addr
|
||||
return None
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ from clan_lib.errors import ClanError
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# TODO: Unify with "create clan" should be done automatically
|
||||
@API.register
|
||||
def create_secrets_user(
|
||||
flake_dir: Path, user: str | None = None, force: bool = False
|
||||
|
||||
Reference in New Issue
Block a user