Sha256: 060a5daa60925891691bad437d58fa85eab46b35953bbd5569f40bda4deba266

Contents?: true

Size: 825 Bytes

Versions: 50

Compression:

Stored size: 825 Bytes

Contents

module MCollective
  class Discovery
    class Mc
      def self.discover(filter, timeout, limit, client)
        begin
          hosts = []
          Timeout.timeout(timeout) do
            reqid = client.sendreq("ping", "discovery", filter)
            Log.debug("Waiting #{timeout} seconds for discovery replies to request #{reqid}")

            loop do
              reply = client.receive(reqid)
              Log.debug("Got discovery reply from #{reply.payload[:senderid]}")
              hosts << reply.payload[:senderid]

              return hosts if limit > 0 && hosts.size == limit
            end
          end
        rescue Timeout::Error => e
        rescue Exception => e
          raise
        ensure
          client.unsubscribe("discovery", :reply)
        end

        hosts
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 3 rubygems

Version Path
choria-mcorpc-support-2.22.1 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.22.0 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.21.1 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.21.0 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.8 lib/mcollective/discovery/mc.rb
mcollective-client-2.12.5 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.7 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.6 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.5 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.4 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.3 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.2 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-2.20.0 lib/mcollective/discovery/mc.rb
choria-mcorpc-support-0.0.1 lib/mcollective/discovery/mc.rb
mcollective-client-2.12.4 lib/mcollective/discovery/mc.rb
mcollective-client-2.12.3 lib/mcollective/discovery/mc.rb
mcollective-client-2.12.1 lib/mcollective/discovery/mc.rb
mcollective-client-2.12.0 lib/mcollective/discovery/mc.rb
mcollective-client-2.10.6 lib/mcollective/discovery/mc.rb
mcollective-client-2.11.4 lib/mcollective/discovery/mc.rb