Class: Specinfra::HostInventory::Filesystem
- Inherits:
-
Base
- Object
- Base
- Specinfra::HostInventory::Filesystem
show all
- Defined in:
- lib/specinfra/host_inventory/filesystem.rb
Instance Method Summary
collapse
Methods inherited from Base
#backend, #initialize
Instance Method Details
#get ⇒ Object
4
5
6
7
8
|
# File 'lib/specinfra/host_inventory/filesystem.rb', line 4
def get
cmd = backend.command.get(:get_inventory_filesystem)
ret = backend.run_command(cmd).stdout.lines
parse(ret)
end
|
#parse(ret) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/specinfra/host_inventory/filesystem.rb', line 9
def parse(ret)
filesystem = {}
ret.each do |line|
next if line =~ /^Filesystem\s+/
if line =~ /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
device = $1
filesystem[device] = {}
filesystem[device]['kb_size'] = $2
filesystem[device]['kb_used'] = $3
filesystem[device]['kb_available'] = $4
filesystem[device]['percent_used'] = $5
filesystem[device]['mount'] = $6
end
end
filesystem
end
|