Merge pull request 'drop secret store logging from install command' (#996) from Mic92-openssh into main
All checks were successful
checks / check-links (push) Successful in 21s
checks / checks (push) Successful in 36s
checks / checks-impure (push) Successful in 1m47s

This commit is contained in:
clan-bot 2024-03-17 20:41:39 +00:00
commit d50eeb8f89

View File

@ -13,10 +13,11 @@ from ..secrets.generate import generate_secrets
log = logging.getLogger(__name__)
def install_nixos(machine: Machine, kexec: str | None = None) -> None:
def install_nixos(
machine: Machine, kexec: str | None = None, debug: bool = False
) -> None:
secrets_module = importlib.import_module(machine.secrets_module)
log.info(f"installing {machine.name}")
log.info(f"using secret store: {secrets_module.SecretStore}")
secret_store = secrets_module.SecretStore(machine=machine)
h = machine.target_host
@ -46,6 +47,8 @@ def install_nixos(machine: Machine, kexec: str | None = None) -> None:
]
if kexec:
cmd += ["--kexec", kexec]
if debug:
cmd.append("--debug")
cmd.append(target_host)
run(
@ -64,6 +67,7 @@ class InstallOptions:
target_host: str
kexec: str | None
confirm: bool
debug: bool
def install_command(args: argparse.Namespace) -> None:
@ -73,6 +77,7 @@ def install_command(args: argparse.Namespace) -> None:
target_host=args.target_host,
kexec=args.kexec,
confirm=not args.yes,
debug=args.debug,
)
machine = Machine(opts.machine, flake=opts.flake)
machine.target_host_address = opts.target_host
@ -82,7 +87,7 @@ def install_command(args: argparse.Namespace) -> None:
if ask != "y":
return
install_nixos(machine, kexec=opts.kexec)
install_nixos(machine, kexec=opts.kexec, debug=opts.debug)
def register_install_parser(parser: argparse.ArgumentParser) -> None:
@ -97,6 +102,12 @@ def register_install_parser(parser: argparse.ArgumentParser) -> None:
help="do not ask for confirmation",
default=False,
)
parser.add_argument(
"--debug",
action="store_true",
help="print debug information",
default=False,
)
parser.add_argument(
"machine",
type=str,