Updated to main
This commit is contained in:
@@ -1,36 +1,14 @@
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
import asyncio
|
||||
|
||||
from ..dirs import get_clan_flake_toplevel
|
||||
from ..nix import nix_eval
|
||||
|
||||
|
||||
def get_vm_inspect_info(machine: str) -> dict:
|
||||
clan_dir = get_clan_flake_toplevel().as_posix()
|
||||
|
||||
# config = nix_config()
|
||||
# system = config["system"]
|
||||
|
||||
return json.loads(
|
||||
subprocess.run(
|
||||
nix_eval(
|
||||
[
|
||||
# f'{clan_dir}#clanInternals.machines."{system}"."{machine}".config.clan.virtualisation' # TODO use this
|
||||
f'{clan_dir}#nixosConfigurations."{machine}".config.system.clan.vm.config'
|
||||
]
|
||||
),
|
||||
stdout=subprocess.PIPE,
|
||||
check=True,
|
||||
text=True,
|
||||
).stdout
|
||||
)
|
||||
from ..webui.routers import vms
|
||||
|
||||
|
||||
def inspect(args: argparse.Namespace) -> None:
|
||||
print(f"Creating VM for {args.machine}")
|
||||
machine = args.machine
|
||||
print(get_vm_inspect_info(machine))
|
||||
clan_dir = get_clan_flake_toplevel().as_posix()
|
||||
res = asyncio.run(vms.inspect_vm(flake_url=clan_dir, flake_attr=args.machine))
|
||||
print(res.json())
|
||||
|
||||
|
||||
def register_inspect_parser(parser: argparse.ArgumentParser) -> None:
|
||||
|
||||
Reference in New Issue
Block a user