add -i option to update-hardware-config
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from clan_lib.machines.hardware import (
|
||||
HardwareConfig,
|
||||
@@ -30,9 +31,11 @@ def update_hardware_config_command(args: argparse.Namespace) -> None:
|
||||
if args.target_host:
|
||||
target_host = Remote.from_ssh_uri(
|
||||
machine_name=machine.name, address=args.target_host
|
||||
).override(host_key_check=host_key_check)
|
||||
).override(host_key_check=host_key_check, private_key=args.identity_file)
|
||||
else:
|
||||
target_host = machine.target_host().override(host_key_check=host_key_check)
|
||||
target_host = machine.target_host().override(
|
||||
host_key_check=host_key_check, private_key=args.identity_file
|
||||
)
|
||||
|
||||
generate_machine_hardware_info(opts, target_host)
|
||||
|
||||
@@ -69,3 +72,9 @@ def register_update_hardware_config(parser: argparse.ArgumentParser) -> None:
|
||||
choices=["nixos-generate-config", "nixos-facter"],
|
||||
default="nixos-facter",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
dest="identity_file",
|
||||
type=Path,
|
||||
help="specify which SSH private key file to use",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user