Method: Inspec::Resources::ZfsPool#gather

Defined in:
lib/resources/zfs_pool.rb

#gatherObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/resources/zfs_pool.rb', line 33

def gather
  cmd = inspec.command("/sbin/zpool get -Hp all #{@zfs_pool}")
  return nil if cmd.exit_status.to_i != 0

  # parse data
  cmd.stdout.chomp.split("\n").each_with_object(Hash.new(0)) do |line, h|
    t = line.split("\t")
    h[t[1].to_s] = t[2].to_s
  end
end