Add --no-reboot flag to clan machine install
This commit is contained in:
@@ -84,7 +84,7 @@ Adding or configuring a new machine requires two simple steps:
|
|||||||
|
|
||||||
=== "**buildClan**"
|
=== "**buildClan**"
|
||||||
|
|
||||||
```nix title="clan-core.lib.buildClan" hl_lines="17 22"
|
```nix title="clan-core.lib.buildClan" hl_lines="18 23"
|
||||||
buildClan {
|
buildClan {
|
||||||
# ...
|
# ...
|
||||||
machines = {
|
machines = {
|
||||||
@@ -117,7 +117,7 @@ Adding or configuring a new machine requires two simple steps:
|
|||||||
|
|
||||||
=== "**flakeParts**"
|
=== "**flakeParts**"
|
||||||
|
|
||||||
```nix title="clan-core.flakeModules.default" hl_lines="17 22"
|
```nix title="clan-core.flakeModules.default" hl_lines="18 23"
|
||||||
clan = {
|
clan = {
|
||||||
# ...
|
# ...
|
||||||
machines = {
|
machines = {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ def install_nixos(
|
|||||||
kexec: str | None = None,
|
kexec: str | None = None,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
password: str | None = None,
|
password: str | None = None,
|
||||||
|
no_reboot: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
secret_facts_module = importlib.import_module(machine.secret_facts_module)
|
secret_facts_module = importlib.import_module(machine.secret_facts_module)
|
||||||
log.info(f"installing {machine.name}")
|
log.info(f"installing {machine.name}")
|
||||||
@@ -53,11 +54,13 @@ def install_nixos(
|
|||||||
"nixos-anywhere",
|
"nixos-anywhere",
|
||||||
"--flake",
|
"--flake",
|
||||||
f"{machine.flake}#{machine.name}",
|
f"{machine.flake}#{machine.name}",
|
||||||
"--no-reboot",
|
|
||||||
"--extra-files",
|
"--extra-files",
|
||||||
str(tmpdir),
|
str(tmpdir),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if no_reboot:
|
||||||
|
cmd.append("--no-reboot")
|
||||||
|
|
||||||
if password:
|
if password:
|
||||||
cmd += [
|
cmd += [
|
||||||
"--env-password",
|
"--env-password",
|
||||||
@@ -90,6 +93,7 @@ class InstallOptions:
|
|||||||
kexec: str | None
|
kexec: str | None
|
||||||
confirm: bool
|
confirm: bool
|
||||||
debug: bool
|
debug: bool
|
||||||
|
no_reboot: bool
|
||||||
json_ssh_deploy: dict[str, str] | None
|
json_ssh_deploy: dict[str, str] | None
|
||||||
|
|
||||||
|
|
||||||
@@ -121,6 +125,7 @@ def install_command(args: argparse.Namespace) -> None:
|
|||||||
kexec=args.kexec,
|
kexec=args.kexec,
|
||||||
confirm=not args.yes,
|
confirm=not args.yes,
|
||||||
debug=args.debug,
|
debug=args.debug,
|
||||||
|
no_reboot=args.no_reboot,
|
||||||
json_ssh_deploy=json_ssh_deploy,
|
json_ssh_deploy=json_ssh_deploy,
|
||||||
)
|
)
|
||||||
machine = Machine(opts.machine, flake=opts.flake)
|
machine = Machine(opts.machine, flake=opts.flake)
|
||||||
@@ -131,7 +136,13 @@ def install_command(args: argparse.Namespace) -> None:
|
|||||||
if ask != "y":
|
if ask != "y":
|
||||||
return
|
return
|
||||||
|
|
||||||
install_nixos(machine, kexec=opts.kexec, debug=opts.debug, password=password)
|
install_nixos(
|
||||||
|
machine,
|
||||||
|
kexec=opts.kexec,
|
||||||
|
debug=opts.debug,
|
||||||
|
password=password,
|
||||||
|
no_reboot=opts.no_reboot,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def find_reachable_host_from_deploy_json(deploy_json: dict[str, str]) -> str:
|
def find_reachable_host_from_deploy_json(deploy_json: dict[str, str]) -> str:
|
||||||
@@ -161,15 +172,15 @@ def register_install_parser(parser: argparse.ArgumentParser) -> None:
|
|||||||
help="use another kexec tarball to bootstrap NixOS",
|
help="use another kexec tarball to bootstrap NixOS",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--yes",
|
"--no-reboot",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="do not ask for confirmation",
|
help="do not reboot after installation",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--debug",
|
"--yes",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="print debug information",
|
help="do not ask for confirmation",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
Reference in New Issue
Block a user