From 7e939271eba0c8e100c506a06cf09c5dd60a1b99 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 20 Apr 2021 08:18:33 -0400 Subject: [PATCH] fix: only report archive dirs if configured --- src/plotman/reporting.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plotman/reporting.py b/src/plotman/reporting.py index 80af0b55..cc9c803c 100644 --- a/src/plotman/reporting.py +++ b/src/plotman/reporting.py @@ -186,10 +186,14 @@ def arch_dir_report(archdir_freebytes, width, prefix=''): # TODO: remove this def dirs_report(jobs, dir_cfg, sched_cfg, width): - return ( - tmp_dir_report(jobs, dir_cfg, sched_cfg, width) + '\n' + - dst_dir_report(jobs, dir_cfg.dst, width) + '\n' + - 'archive dirs free space:\n' + - arch_dir_report(archive.get_archdir_freebytes(dir_cfg.archive), width) + '\n' - ) - + reports = [ + tmp_dir_report(jobs, dir_cfg, sched_cfg, width), + dst_dir_report(jobs, dir_cfg.dst, width), + ] + if dir_cfg.archive is not None: + reports.extend([ + 'archive dirs free space:', + arch_dir_report(archive.get_archdir_freebytes(dir_cfg.archive), width), + ]) + + return '\n'.join(reports) + '\n'