X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2FMCollective%2FRegistration%2FBase.html;fp=doc%2FMCollective%2FRegistration%2FBase.html;h=81d4ff1075968bd8745653aee724f5eaec112750;hb=7c9314f502cde8daad23b61d10b24a542e04154a;hp=0000000000000000000000000000000000000000;hpb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/MCollective/Registration/Base.html b/doc/MCollective/Registration/Base.html new file mode 100644 index 0000000..81d4ff1 --- /dev/null +++ b/doc/MCollective/Registration/Base.html @@ -0,0 +1,655 @@ + + + + + + + Class: MCollective::Registration::Base + + + + + + + + + + + +
+
+
+

In Files

+ +
+ + +
+ +
+ + + +
+

Parent

+ + + +
+ + + + + + + +
+

Methods

+ +
+ + + + +
+ +
+ + + + + +
+

Class Index + [+]

+
+
+ Quicksearch + +
+
+ + + +
+ + +
+
+ +
+

MCollective::Registration::Base

+ +
+

+This is a base class that other registration plugins can use to handle +regular announcements to the mcollective +

+

+The configuration file determines how often registration messages gets sent +using the registerinterval option, the plugin runs in the +background in a thread. +

+ +
+ + + + + + + + + +
+

Public Class Methods

+ + +
+ + +
+ + inherited(klass) + click to toggle source + +
+ +
+ +

+Register plugins that inherits base +

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 11
+11:       def self.inherited(klass)
+12:         PluginManager << {:type => "registration_plugin", :class => klass.to_s}
+13:       end
+
+ +
+ + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ + +
+ + config() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 36
+36:       def config
+37:         Config.instance
+38:       end
+
+ +
+ + +
+ + +
+ + +
+ + interval() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 59
+59:       def interval
+60:         config.registerinterval
+61:       end
+
+ +
+ + +
+ + +
+ + +
+ + msg_filter() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 40
+40:       def msg_filter
+41:         filter = Util.empty_filter
+42:         filter["agent"] << "registration"
+43:         filter
+44:       end
+
+ +
+ + +
+ + +
+ + +
+ + publish(message) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 63
+63:       def publish(message)
+64:         unless message
+65:           Log.debug("Skipping registration due to nil body")
+66:         else
+67:           req = Message.new(message, nil, {:type => :request, :agent => "registration", :collective => target_collective, :filter => msg_filter})
+68:           req.encode!
+69: 
+70:           Log.debug("Sending registration #{req.requestid} to collective #{req.collective}")
+71: 
+72:           req.publish
+73:         end
+74:       end
+
+ +
+ + +
+ + +
+ + +
+ + run(connection) + click to toggle source + +
+ +
+ +

+Creates a background thread that periodically send a registration notice. +

+

+The actual registration notices comes from the ‘body’ method of +the registration plugins. +

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 19
+19:       def run(connection)
+20:         return false if interval == 0
+21: 
+22:         Thread.new do
+23:           loop do
+24:             begin
+25:               publish(body)
+26: 
+27:               sleep interval
+28:             rescue Exception => e
+29:               Log.error("Sending registration message failed: #{e}")
+30:               sleep interval
+31:             end
+32:           end
+33:         end
+34:       end
+
+ +
+ + +
+ + +
+ + +
+ + target_collective() + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
+
+    # File lib/mcollective/registration/base.rb, line 46
+46:       def target_collective
+47:         main_collective = config.main_collective
+48: 
+49:         collective = config.registration_collective || main_collective
+50: 
+51:         unless config.collectives.include?(collective)
+52:           Log.warn("Sending registration to #{main_collective}: #{collective} is not a valid collective")
+53:           collective = main_collective
+54:         end
+55: 
+56:         return collective
+57:       end
+
+ +
+ + +
+ + +
+ + +
+ + +
+ +

Disabled; run with --debug to generate this.

+ +
+ +
+

[Validate]

+

Generated with the Darkfish + Rdoc Generator 1.1.6.

+
+ + + +