From 86556d31cd6efdf212262a3d0d4779a89285e0f8 Mon Sep 17 00:00:00 2001 From: Travis Holloway Date: Tue, 19 Nov 2024 12:55:49 -0600 Subject: [PATCH] Update DiskSpace check to account for Ubuntu Case RE-672: This increasing the amount of free space needed on '/boot'. It also adds a check for '/tmp' and '/' ensuring that they have a minimally amount of free space as well. Changelog: Update DiskSpace check to account for Ubuntu --- elevate-cpanel | 4 ++- lib/Elevate/Components/DiskSpace.pm | 4 ++- t/components-DiskSpace.t | 50 +++++++++++++++++------------ 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/elevate-cpanel b/elevate-cpanel index 76ac67fc..fd3428a4 100755 --- a/elevate-cpanel +++ b/elevate-cpanel @@ -1590,9 +1590,11 @@ BEGIN { # Suppress load of all of these at earliest point. sub _disk_space_check ($self) { my $need_space = { - '/boot' => 120 * MEG, + '/boot' => 200 * MEG, '/usr/local/cpanel' => 1.5 * GIG, # '/var/lib' => 5 * GIG, + '/tmp' => 5 * MEG, + '/' => 5 * GIG, }; my @keys = ( sort keys %$need_space ); diff --git a/lib/Elevate/Components/DiskSpace.pm b/lib/Elevate/Components/DiskSpace.pm index 0bfbe7bb..85b1637f 100644 --- a/lib/Elevate/Components/DiskSpace.pm +++ b/lib/Elevate/Components/DiskSpace.pm @@ -48,9 +48,11 @@ sub _disk_space_check ($self) { # - /boot is small enough # - /usr/local/cpanel is not going to be used at the same time than /var/lib my $need_space = { - '/boot' => 120 * MEG, + '/boot' => 200 * MEG, '/usr/local/cpanel' => 1.5 * GIG, # '/var/lib' => 5 * GIG, + '/tmp' => 5 * MEG, + '/' => 5 * GIG, }; my @keys = ( sort keys %$need_space ); diff --git a/t/components-DiskSpace.t b/t/components-DiskSpace.t index 21c4d997..fbb1785f 100644 --- a/t/components-DiskSpace.t +++ b/t/components-DiskSpace.t @@ -50,43 +50,49 @@ EOS like( dies { check_blocker() }, - qr{expected 3 lines ; got 1 lines}, + qr{expected 5 lines ; got 1 lines}, "_disk_space_check" ); $saferun_output = < available 119 M}], + [qr{/boot needs 200 M => available 199 M}], q[Got expected warnings] ); @@ -96,9 +102,11 @@ my $usr_local_cpanel = 2 * GIG; $saferun_output = <<"EOS"; Filesystem 1K-blocks Used Available Use% Mounted on -/dev/vda1 83874796 76307692 7567104 91% / -/dev/vda1 83874796 76307692 $usr_local_cpanel 91% / -/dev/vda1 83874796 76307692 7567104 91% / +/dev/vda1 20134592 11245932 8872276 56% / +/dev/vda1 20134592 11245932 8872276 56% / +/dev/loop6 714624 92 677364 1% /tmp +/dev/vda1 20134592 11245932 $usr_local_cpanel 56% / +/dev/vda1 20134592 11245932 8872276 56% / EOS is( check_blocker(), 1, "_disk_space_check ok - /usr/local/cpanel 2 G" ); @@ -107,9 +115,11 @@ $usr_local_cpanel = 1.4 * GIG; $saferun_output = <<"EOS"; Filesystem 1K-blocks Used Available Use% Mounted on -/dev/vda1 83874796 76307692 7567104 91% / -/dev/vda1 83874796 76307692 $usr_local_cpanel 91% / -/dev/vda1 83874796 76307692 7567104 91% / +/dev/vda1 20134592 11245932 8872276 56% / +/dev/vda1 20134592 11245932 8872276 56% / +/dev/loop6 714624 92 677364 1% /tmp +/dev/vda1 20134592 11245932 $usr_local_cpanel 56% / +/dev/vda1 20134592 11245932 8872276 56% / EOS like(