From 00bd23eb04eab5ae8235034dced95661f085bf76 Mon Sep 17 00:00:00 2001 From: "cs@twoflower" Date: Thu, 15 Sep 2016 17:01:21 +0100 Subject: [PATCH] fix status_checks.py free disk space reporting #932 --- management/status_checks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/management/status_checks.py b/management/status_checks.py index 13cbab12..527495c7 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -229,15 +229,15 @@ def check_free_disk_space(rounded_values, env, output): st = os.statvfs(env['STORAGE_ROOT']) bytes_total = st.f_blocks * st.f_frsize bytes_free = st.f_bavail * st.f_frsize - if not rounded_values: - disk_msg = "The disk has %s GB space remaining." % str(round(bytes_free/1024.0/1024.0/1024.0*10.0)/10) - else: - disk_msg = "The disk has less than %s%% space left." % str(round(bytes_free/bytes_total/10 + .5)*10) + disk_msg = "The disk has %.2f GB space remaining." % (bytes_free/1024.0/1024.0/1024.0) if bytes_free > .3 * bytes_total: + if rounded_values: disk_msg = "The disk has more than 30% free space." output.print_ok(disk_msg) elif bytes_free > .15 * bytes_total: + if rounded_values: disk_msg = "The disk has less than 30% free space." output.print_warning(disk_msg) else: + if rounded_values: disk_msg = "The disk has less than 15% free space." output.print_error(disk_msg) def check_free_memory(rounded_values, env, output): @@ -472,7 +472,7 @@ def check_dns_zone(domain, env, output, dns_zonefiles): % (existing_ns, correct_ns) ) # Check that each custom secondary nameserver resolves the IP address. - + if custom_secondary_ns and not probably_external_dns: for ns in custom_secondary_ns: # We must first resolve the nameserver to an IP address so we can query it. @@ -897,7 +897,7 @@ class FileOutput: class ConsoleOutput(FileOutput): def __init__(self): self.buf = sys.stdout - + # Do nice line-wrapping according to the size of the terminal. # The 'stty' program queries standard input for terminal information. if sys.stdin.isatty():