full-setup: diagnose() prints the failed units and the journal tail only
On a timed-out wait, diagnose() prints systemctl --failed for the machine or container and the last 50 journal lines of the units waited on. It no longer prints `systemctl status` for them. Only the failure path changes.
This commit is contained in:
parent
702974867f
commit
a2cd4f3da8
1 changed files with 2 additions and 3 deletions
|
|
@ -206,14 +206,13 @@ pkgs.testers.runNixOSTest (
|
||||||
)
|
)
|
||||||
|
|
||||||
def diagnose(unit=None, container=None):
|
def diagnose(unit=None, container=None):
|
||||||
# What a timed-out wait leaves behind: the failed units, and the status
|
# What a timed-out wait leaves behind: the failed units and the end of the
|
||||||
# and the end of the journal of the unit that was waited on.
|
# journal of the units that were waited on.
|
||||||
where = f"--machine={container} " if container else ""
|
where = f"--machine={container} " if container else ""
|
||||||
units = [unit] if isinstance(unit, str) else list(unit or [])
|
units = [unit] if isinstance(unit, str) else list(unit or [])
|
||||||
flags = " ".join(f"-u '{u}'" for u in units)
|
flags = " ".join(f"-u '{u}'" for u in units)
|
||||||
for command in [
|
for command in [
|
||||||
f"systemctl {where}--failed --no-legend --no-pager",
|
f"systemctl {where}--failed --no-legend --no-pager",
|
||||||
*([f"systemctl {where}status --no-pager -n 0 -l {' '.join(units)} | head -c 4000"] if units else []),
|
|
||||||
*([f"journalctl {where}{flags} --no-pager -n 50 | tail -c 6000"] if units else []),
|
*([f"journalctl {where}{flags} --no-pager -n 50 | tail -c 6000"] if units else []),
|
||||||
]:
|
]:
|
||||||
print(f"--- {command}")
|
print(f"--- {command}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue