Class: Koma::Backend::Base
- Inherits:
-
Object
- Object
- Koma::Backend::Base
- Defined in:
- lib/koma/backend/base.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#inventory_keys ⇒ Object
readonly
Returns the value of attribute inventory_keys.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(host, options) ⇒ Base
constructor
A new instance of Base.
- #out(key = nil) ⇒ Object
Constructor Details
#initialize(host, options) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 |
# File 'lib/koma/backend/base.rb', line 6 def initialize(host, ) @host = host @options = @inventory_keys = Koma::HostInventory.inventory_keys end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/koma/backend/base.rb', line 4 def host @host end |
#inventory_keys ⇒ Object (readonly)
Returns the value of attribute inventory_keys.
4 5 6 |
# File 'lib/koma/backend/base.rb', line 4 def inventory_keys @inventory_keys end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/koma/backend/base.rb', line 4 def @options end |
Instance Method Details
#out(key = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/koma/backend/base.rb', line 12 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["enable-#{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 |