Method: Inspec::Resources::FileSystemResource#size

Defined in:
lib/resources/filesystem.rb

#sizeObject



17
18
19
20
21
22
23
24
25
# File 'lib/resources/filesystem.rb', line 17

def size
  @size ||= begin
    cmd = inspec.command("df #{partition} --output=size")
    raise Inspec::Exceptions::ResourceFailed, "Unable to get available space for partition #{partition}" if cmd.stdout.nil? || cmd.stdout.empty? || !cmd.exit_status.zero?

    value = cmd.stdout.gsub(/\dK-blocks[\r\n]/, '').strip
    value.to_i
  end
end