Sha256: 310e0d94c6ec07bbc08a3b3819d4e8eec7cbb8ee413dfb3b26430fd7a7e5c14b

Contents?: true

Size: 841 Bytes

Versions: 6

Compression:

Stored size: 841 Bytes

Contents

include Specinfra::Helper::Set

class Koma::Backend::Base
  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["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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
koma-0.17.0 lib/koma/backend/base.rb
koma-0.16.0 lib/koma/backend/base.rb
koma-0.15.0 lib/koma/backend/base.rb
koma-0.14.0 lib/koma/backend/base.rb
koma-0.13.0 lib/koma/backend/base.rb
koma-0.12.0 lib/koma/backend/base.rb