Class: Specinfra::HostInventory::Filesystem

Inherits:
Object
  • Object
show all
Defined in:
lib/pullmatic/resource/filesystem.rb

Instance Method Summary collapse

Instance Method Details

#parse(ret) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/pullmatic/resource/filesystem.rb', line 30

def parse(ret)
  filesystem = {}
  ret.each_line do |line|
    next if line =~ /^Filesystem\s+/
    if line =~ /^(.+?)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
      device = $1
      filesystem[device] = {}
      filesystem[device]['type'] = $2
      filesystem[device]['kb_size'] = $3
      filesystem[device]['kb_used'] = $4
      filesystem[device]['kb_available'] = $5
      filesystem[device]['percent_used'] = $6
      filesystem[device]['mount'] = $7
    end
  end
  filesystem
end