Merge pull request 'Refactor(lib/inventory): move machine actions into clan_lib/machines/actions.py' (#3770) from chores-3 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3770
This commit is contained in:
@@ -9,13 +9,13 @@ from clan_lib.api.modules import parse_frontmatter
|
|||||||
from clan_lib.dirs import specific_machine_dir
|
from clan_lib.dirs import specific_machine_dir
|
||||||
from clan_lib.errors import ClanError
|
from clan_lib.errors import ClanError
|
||||||
from clan_lib.flake import Flake
|
from clan_lib.flake import Flake
|
||||||
|
from clan_lib.machines.actions import get_machine
|
||||||
from clan_lib.machines.machines import Machine
|
from clan_lib.machines.machines import Machine
|
||||||
from clan_lib.nix_models.inventory import Machine as InventoryMachine
|
from clan_lib.nix_models.inventory import Machine as InventoryMachine
|
||||||
from clan_lib.persist.inventory_store import InventoryStore
|
from clan_lib.persist.inventory_store import InventoryStore
|
||||||
|
|
||||||
from clan_cli.completions import add_dynamic_completer, complete_tags
|
from clan_cli.completions import add_dynamic_completer, complete_tags
|
||||||
from clan_cli.machines.hardware import HardwareConfig
|
from clan_cli.machines.hardware import HardwareConfig
|
||||||
from clan_cli.machines.inventory import get_machine
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def remove_machine(flake_dir: Path, name: str) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_machine(flake_dir: Path, name: str) -> str:
|
def get_machine_pubkey(flake_dir: Path, name: str) -> str:
|
||||||
key = read_key(sops_machines_folder(flake_dir) / name)
|
key = read_key(sops_machines_folder(flake_dir) / name)
|
||||||
return key.pubkey
|
return key.pubkey
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ def get_command(args: argparse.Namespace) -> None:
|
|||||||
if args.flake is None:
|
if args.flake is None:
|
||||||
msg = "Could not find clan flake toplevel directory"
|
msg = "Could not find clan flake toplevel directory"
|
||||||
raise ClanError(msg)
|
raise ClanError(msg)
|
||||||
print(get_machine(args.flake.path, args.machine))
|
print(get_machine_pubkey(args.flake.path, args.machine))
|
||||||
|
|
||||||
|
|
||||||
def remove_command(args: argparse.Namespace) -> None:
|
def remove_command(args: argparse.Namespace) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user