Class: MCollective::Agent::Discovery

Inherits:
Object
  • Object
show all
Defined in:
lib/mcollective/agent/discovery.rb

Overview

Discovery agent for The Marionette Collective

Released under the Apache License, Version 2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDiscovery

Returns a new instance of Discovery.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mcollective/agent/discovery.rb', line 9

def initialize
  config = Config.instance.pluginconf

  @timeout = 5
  @meta = {:license => "Apache License, Version 2",
           :author => "R.I.Pienaar <[email protected]>",
           :timeout => @timeout,
           :name => "Discovery Agent",
           :version => MCollective.version,
           :url => "http://www.marionette-collective.org",
           :description => "MCollective Discovery Agent"}
end

Instance Attribute Details

#metaObject (readonly)

Returns the value of attribute meta.



7
8
9
# File 'lib/mcollective/agent/discovery.rb', line 7

def meta
  @meta
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



7
8
9
# File 'lib/mcollective/agent/discovery.rb', line 7

def timeout
  @timeout
end

Instance Method Details

#handlemsg(msg, stomp) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mcollective/agent/discovery.rb', line 22

def handlemsg(msg, stomp)
  reply = "unknown request"

  case msg[:body]
    when "ping"
      reply = "pong"

    else
      reply = "Unknown Request: #{msg[:body]}"
  end

  reply
end