Class: Inspec::Resources::LinuxFileSystemResource

Inherits:
FsManagement
  • Object
show all
Defined in:
lib/resources/filesystem.rb

Instance Attribute Summary

Attributes inherited from FsManagement

#inspec

Instance Method Summary collapse

Methods inherited from FsManagement

#initialize

Constructor Details

This class inherits a constructor from Inspec::Resources::FsManagement

Instance Method Details

#info(partition) ⇒ Object



69
70
71
72
73
74
75
76
77
78
# File 'lib/resources/filesystem.rb', line 69

def info(partition)
  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
  {
    name: partition,
    size: value.to_i,
    type: false,
  }
end