mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
deploy: print hostnames while processing
This commit is contained in:
parent
c50222cfe7
commit
79f1a07fc5
1 changed files with 3 additions and 3 deletions
|
@ -92,6 +92,8 @@ def check(hosts):
|
||||||
print("#" * 64)
|
print("#" * 64)
|
||||||
|
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
|
print(host.rjust(hostwidth + 1), end=" ", flush=True)
|
||||||
|
|
||||||
current_sys, cur_kernel, boot_kernel = (
|
current_sys, cur_kernel, boot_kernel = (
|
||||||
run(
|
run(
|
||||||
[
|
[
|
||||||
|
@ -113,8 +115,6 @@ def check(hosts):
|
||||||
reboot_needed = cur_kernel != boot_kernel
|
reboot_needed = cur_kernel != boot_kernel
|
||||||
update_needed = current_sys != new_sys[host]
|
update_needed = current_sys != new_sys[host]
|
||||||
|
|
||||||
print(host.rjust(hostwidth + 1), end=" ")
|
|
||||||
|
|
||||||
if not (reboot_needed or update_needed):
|
if not (reboot_needed or update_needed):
|
||||||
print(icon_good, "[OK]")
|
print(icon_good, "[OK]")
|
||||||
continue
|
continue
|
||||||
|
@ -150,9 +150,9 @@ def push(hosts):
|
||||||
def rexec(hosts, cmd):
|
def rexec(hosts, cmd):
|
||||||
hostwidth = max(map(len, hosts))
|
hostwidth = max(map(len, hosts))
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
|
print(host.rjust(hostwidth), end=" ", flush=True)
|
||||||
r = run(["ssh", host, "--"] + cmd, stdout=PIPE, stderr=STDOUT)
|
r = run(["ssh", host, "--"] + cmd, stdout=PIPE, stderr=STDOUT)
|
||||||
lines = r.stdout.decode("utf8").strip("\n").splitlines()
|
lines = r.stdout.decode("utf8").strip("\n").splitlines()
|
||||||
print(host.rjust(hostwidth), end=" ")
|
|
||||||
print(icon_bad if r.returncode else icon_good, end=" ")
|
print(icon_bad if r.returncode else icon_good, end=" ")
|
||||||
if len(lines) == 1:
|
if len(lines) == 1:
|
||||||
print(lines[0])
|
print(lines[0])
|
||||||
|
|
Loading…
Reference in a new issue