lib/koma/backend/base.rb in koma-0.6.0 vs lib/koma/backend/base.rb in koma-0.7.0
- old
+ new
@@ -1,32 +1,34 @@
include Specinfra::Helper::Set
class Koma::Backend::Base
- attr_reader :host, :options
+ attr_reader :host, :options, :inventory_keys
def initialize(host, options)
@host = host
@options = options
+ @inventory_keys = Koma::HostInventory.inventory_keys
end
def out(key = nil)
out = {}
keys = if key.nil?
inventory_keys
else
key.split(',')
end
+ Koma::HostInventory.disabled_keys.each do |k|
+ keys.push(k) if @options["with-#{k}"]
+ end
+
keys.each do |k|
+ raise Koma::NotImplementedKeyError unless Koma::HostInventory.all_inventory_keys.include?(k)
begin
out[k] = Specinfra.backend.host_inventory[k]
out[k] = Specinfra.backend.host_inventory[k].inspect if k == 'ec2'
rescue NotImplementedError
out[k] = nil
end
end
out
- end
-
- def inventory_keys
- Specinfra::HostInventory.inventory_keys
end
end