Sha256: fee6d9a0ca482a6d1771b6438b79cff3ac6a8687daba56d97a68406ce5c86930

Contents?: true

Size: 877 Bytes

Versions: 14

Compression:

Stored size: 877 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|
          logging(to_inventory(backend, hi), 'info')
        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

14 entries across 14 versions & 1 rubygems

Version Path
rundock-1.2.1 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.2.0 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.7 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.6 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.5 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.4 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.3 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.2 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.1 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.1.0 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.8 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.7 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.6 lib/rundock/plugin/operation/host_inventory.rb
rundock-1.0.5 lib/rundock/plugin/operation/host_inventory.rb