update!: switch from one comma-sep. argument to variadic args. for hosts

Since the hosts are what nixos-rebuild acts on it makes to have them
represented by unlimited variadic arguments similar to how "git add",
"cat", "nix build", etc. work.
This commit is contained in:
June 2024-06-06 21:08:38 +02:00
parent 11a2b74aee
commit 3cdd4ba8b5
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
2 changed files with 8 additions and 9 deletions

View file

@ -10,42 +10,42 @@ def infra_rebuild():
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def build(hosts): def build(hosts):
operations.run("build", hosts) operations.run("build", hosts)
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def build_vm(hosts): def build_vm(hosts):
operations.run("build-vm", hosts) operations.run("build-vm", hosts)
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def build_vm_with_bootloader(hosts): def build_vm_with_bootloader(hosts):
operations.run("build-vm-with-bootloader", hosts) operations.run("build-vm-with-bootloader", hosts)
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def switch(hosts): def switch(hosts):
operations.run("switch", hosts) operations.run("switch", hosts)
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def boot(hosts): def boot(hosts):
operations.run("boot", hosts) operations.run("boot", hosts)
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def test(hosts): def test(hosts):
operations.run("test", hosts) operations.run("test", hosts)
@infra_rebuild.command() @infra_rebuild.command()
@click.argument("hosts") @click.argument("hosts", nargs=-1)
def reboot(hosts): def reboot(hosts):
operations.run("reboot", hosts) operations.run("reboot", hosts)

View file

@ -23,8 +23,7 @@ def run(operation, hosts):
msg.error("Internal Error: The given operation isn't valid.") msg.error("Internal Error: The given operation isn't valid.")
sys.exit(1) sys.exit(1)
for host_string in hosts.split(","): for host in hosts:
host = host_string.strip()
if not host: if not host:
msg.warning("Skipping empty string provided for host.") msg.warning("Skipping empty string provided for host.")
continue continue