class Specinfra::HostInventory::Ohai

Public Instance Methods

get() click to toggle source
# File lib/specinfra/host_inventory/ohai.rb, line 4
def get
  begin
    require 'json'
  rescue LoadError
    return nil
  end

  begin
    ret = backend.run_command('ohai --log_level error')
  rescue StandardError
    nil
  end

  ret.exit_status.zero? ? JSON.parse(ret.stdout) : nil
end