Class: Specinfra::HostInventory::Hosts

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

Instance Method Summary collapse

Instance Method Details

#getObject



42
43
44
45
46
47
48
49
50
# File 'lib/pullmatic/resource/network.rb', line 42

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

#parse(ret) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/pullmatic/resource/network.rb', line 52

def parse(ret)
  entries = []
  ret.split("\n").each do |l|
    entries << l if l =~ /^[^#]+/
  end
  entries
end