Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions definitions/checks/disk/available_space.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ module Disk
class AvailableSpace < ForemanMaintain::Check
metadata do
label :available_space
description 'Check to make sure root(/) partition has enough space'
description 'Check if /var/cache partition has enough space for transaction'
tags :pre_upgrade
end

MIN_SPACE_IN_MB = 4096

def run
assert(enough_space?, "System has less than #{MIN_SPACE_IN_MB / 1024}GB space available"\
' on root(/) partition')
' on /var/cache partition')
end

def enough_space?
io_obj = ForemanMaintain::Utils::Disk::IODevice.new('/')
device = ForemanMaintain::Utils::Disk::Device.new('/var/cache').name
io_obj = ForemanMaintain::Utils::Disk::IODevice.new(device)
io_obj.available_space > MIN_SPACE_IN_MB
end
end
Expand Down