Class: Specinfra::HostInventory::Package
- Defined in:
- lib/koma/ext/specinfra/host_inventory/package.rb
Instance Method Summary collapse
Instance Method Details
#get ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/koma/ext/specinfra/host_inventory/package.rb', line 4 def get cmd = backend.command.get(:get_inventory_package) ret = backend.run_command(cmd) if ret.exit_status == 0 parse(ret.stdout) else nil end end |
#parse(cmd_ret) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/koma/ext/specinfra/host_inventory/package.rb', line 14 def parse(cmd_ret) packages = {} lines = cmd_ret.split(/\n/) lines.each do |line| h = Hash[line.split("\t").map { |f| f.split(':', 2) }] idx = h['name'] packages[idx] = h end packages end |