Sha256: 1b1de88e71b896c715dac4eec15a900a57947606b27536addf0b0e3174e11140

Contents?: true

Size: 873 Bytes

Versions: 33

Compression:

Stored size: 873 Bytes

Contents

require 'rundock/operation/base'

module Rundock
  module Operation
    # You can use this sample as following scenario.yml for example.
    #
    # - node: anyhost-01
    #   host_inventory:
    #     memory:
    #       total:
    # ---
    # anyhost-01:
    #   host: 192.168.1.11
    #   ssh_opts:
    #     port: 22
    #     user: anyuser
    #     key:  ~/.ssh/id_rsa
    # ---
    class HostInventory < Base
      def run(backend, attributes)
        attributes[:host_inventory].each do |hi|
          Logger.info(to_inventory(backend, hi))
        end
      end

      private

      def to_inventory(backend, inventory)
        ret = nil
        inventory.split('/').each do |s|
          if ret.nil?
            ret = backend.host_inventory[s.to_s]
            next
          end

          ret = ret[s.to_s]
        end

        ret
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
rundock-1.0.4 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.2 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.1 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.0 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.5.8 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.5.7 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.5.4 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.5.3 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.5.2 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.5.0 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.16 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.15 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.14 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.13 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.12 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.11 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.10 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.8 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.7 lib/rundock/plugin/operation/host_inventory.rb
rundock-0.4.6 lib/rundock/plugin/operation/host_inventory.rb