machines/update: get flake_attr from machine class

This commit is contained in:
Jörg Thalheim 2024-02-06 15:44:07 +01:00
parent a2f0d077c8
commit 301a6b6a23
3 changed files with 5 additions and 8 deletions

View File

@ -23,8 +23,6 @@ def install_nixos(machine: Machine, kexec: str | None = None) -> None:
target_host = f"{h.user or 'root'}@{h.host}"
log.info(f"target host: {target_host}")
flake_attr = h.meta.get("flake_attr", "")
generate_secrets(machine)
with TemporaryDirectory() as tmpdir_:
@ -40,7 +38,7 @@ def install_nixos(machine: Machine, kexec: str | None = None) -> None:
cmd = [
"nixos-anywhere",
"-f",
f"{machine.flake}#{flake_attr}",
f"{machine.flake}#{machine.name}",
"-t",
"--no-reboot",
"--extra-files",

View File

@ -105,10 +105,10 @@ def deploy_nixos(hosts: HostGroup) -> None:
ssh_arg += " -i " + h.key if h.key else ""
flake_attr = h.meta.get("flake_attr", "")
machine: Machine = h.meta["machine"]
generate_secrets(h.meta["machine"])
upload_secrets(h.meta["machine"])
generate_secrets(machine)
upload_secrets(machine)
target_host = h.meta.get("target_host")
if target_host:
@ -130,7 +130,7 @@ def deploy_nixos(hosts: HostGroup) -> None:
"--build-host",
"",
"--flake",
f"{path}#{flake_attr}",
f"{path}#{machine.name}",
]
if target_host:
cmd.extend(["--target-host", target_host])

View File

@ -775,7 +775,6 @@ def parse_deployment_address(
hostname = result.hostname
port = result.port
meta = meta.copy()
meta["flake_attr"] = machine_name
return Host(
hostname,
user=user,