Class: Specinfra::HostInventory::Mount

Inherits:
Base
  • Object
show all
Defined in:
lib/specinfra/host_inventory/mount.rb

Instance Method Summary collapse

Methods inherited from Base

#backend, #initialize

Constructor Details

This class inherits a constructor from Specinfra::HostInventory::Base

Instance Method Details

#getObject



4
5
6
7
8
9
10
11
12
# File 'lib/specinfra/host_inventory/mount.rb', line 4

def get
  cmd = backend.command.get(:get_inventory_mount)
  ret = backend.run_command(cmd)
  if ret.exit_status == 0
    parse(ret.stdout)
  else
    nil
  end
end

#parse(ret) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/specinfra/host_inventory/mount.rb', line 13

def parse(ret)
  mounts = []
  ret.each_line do |line|
    mount = {}
    if line =~ /^(.+)\s+(.+)\s+(.+)\s+(.+)\s+(\d+)\s+(\d+)$/
      mount['device'] = $1
      mount['point'] = $2
      mount['type'] = $3
      mount['options'] = $4.split(',')
      mount['dump'] = $5
      mount['pass'] = $6
    end
    mounts << mount
  end
  mounts
end