We previously modeled the connectors quite close to the stomp gem
and it had a bad choice to use the send method for publishing.

This renamed the connector plugin send to publish everywhere and
update tests.

Remove an accidental log message that was left during debugging
of RPC::Agent

Signed-off-by: R.I.Pienaar <[email protected]>
---
Local-branch: feature/master/7623
 lib/mcollective/client.rb                          |    2 +-
 lib/mcollective/connector/base.rb                  |    2 +-
 lib/mcollective/registration/base.rb               |    2 +-
 lib/mcollective/rpc/agent.rb                       |    1 -
 lib/mcollective/runner.rb                          |    2 +-
 plugins/mcollective/connector/stomp.rb             |    2 +-
 .../plugins/mcollective/connector/stomp_spec.rb    |   14 +++++++-------
 website/changelog.md                               |    1 +
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/mcollective/client.rb b/lib/mcollective/client.rb
index b597a2e..7e33db1 100644
--- a/lib/mcollective/client.rb
+++ b/lib/mcollective/client.rb
@@ -62,7 +62,7 @@ module MCollective
             end
 
             Timeout.timeout(2) do
-                @connection.send(target, req)
+                @connection.publish(target, req)
             end
 
             reqid
diff --git a/lib/mcollective/connector/base.rb 
b/lib/mcollective/connector/base.rb
index 7e2ceca..6e4c6ad 100644
--- a/lib/mcollective/connector/base.rb
+++ b/lib/mcollective/connector/base.rb
@@ -7,7 +7,7 @@ module MCollective
     # receive       - Receive data from the middleware, should act like a 
blocking call only returning if/when data
     #                 was received.  It should get data from all subscribed 
channels/topics.  Individual messages
     #                 should be returned as MCollective::Request objects with 
the payload provided
-    # send          - Takes a target and msg, should send the message to the 
supplied target topic or destination
+    # publish       - Takes a target and msg, should send the message to the 
supplied target topic or destination
     # subscribe     - Adds a subscription to a specific message source
     # unsubscribe   - Removes a subscription to a specific message source
     # disconnect    - Disconnects from the middleware
diff --git a/lib/mcollective/registration/base.rb 
b/lib/mcollective/registration/base.rb
index 7a0f386..969ee30 100644
--- a/lib/mcollective/registration/base.rb
+++ b/lib/mcollective/registration/base.rb
@@ -33,7 +33,7 @@ module MCollective
                                 req = 
PluginManager["security_plugin"].encoderequest(config.identity, target, 
registration_message, reqid, filter)
 
                                 Log.debug("Sending registration #{reqid} to 
#{target}")
-                                connection.send(target, req)
+                                connection.publish(target, req)
                             else
                                 Log.debug("Skipping registration due to nil 
body")
                             end
diff --git a/lib/mcollective/rpc/agent.rb b/lib/mcollective/rpc/agent.rb
index 113f8e2..b7aba75 100644
--- a/lib/mcollective/rpc/agent.rb
+++ b/lib/mcollective/rpc/agent.rb
@@ -143,7 +143,6 @@ module MCollective
             def self.activate?
                 agent_name = self.to_s.split("::").last.downcase
 
-                Log.debug("Meh? : #{respond_to?("meh")}")
                 Log.debug("Starting default activation checks for 
#{agent_name}")
 
                 should_activate = 
Config.instance.pluginconf["#{agent_name}.activate_agent"]
diff --git a/lib/mcollective/runner.rb b/lib/mcollective/runner.rb
index 4d4402c..fe5c8fd 100644
--- a/lib/mcollective/runner.rb
+++ b/lib/mcollective/runner.rb
@@ -147,7 +147,7 @@ module MCollective
         def reply(sender, target, msg, requestid, callerid)
             reply = @security.encodereply(sender, target, msg, requestid, 
callerid)
 
-            @connection.send(target, reply)
+            @connection.publish(target, reply)
 
             @stats.sent
         end
diff --git a/plugins/mcollective/connector/stomp.rb 
b/plugins/mcollective/connector/stomp.rb
index c96745b..5fb6432 100644
--- a/plugins/mcollective/connector/stomp.rb
+++ b/plugins/mcollective/connector/stomp.rb
@@ -145,7 +145,7 @@ module MCollective
             end
 
             # Sends a message to the Stomp connection
-            def send(target, msg)
+            def publish(target, msg)
                 Log.debug("Sending a message to Stomp target '#{target}'")
 
                 msg = SSL.base64_encode(msg) if @base64
diff --git a/spec/unit/plugins/mcollective/connector/stomp_spec.rb 
b/spec/unit/plugins/mcollective/connector/stomp_spec.rb
index d1c5c77..0c91c5e 100644
--- a/spec/unit/plugins/mcollective/connector/stomp_spec.rb
+++ b/spec/unit/plugins/mcollective/connector/stomp_spec.rb
@@ -158,7 +158,7 @@ module MCollective
                 end
             end
 
-            describe "#send" do
+            describe "#publish" do
                 before do
                     
@connection.stubs("respond_to?").with("publish").returns(true)
                     @connection.stubs(:publish).with("test", "msg", 
{}).returns(true)
@@ -170,7 +170,7 @@ module MCollective
                     @c.instance_variable_set("@base64", true)
                     @c.expects(:msgheaders).returns({})
 
-                    @c.send("test", "msg")
+                    @c.publish("test", "msg")
                 end
 
                 it "should not base64 encode if not configured to do so" do
@@ -179,14 +179,14 @@ module MCollective
 
                     SSL.expects(:base64_encode).never
 
-                    @c.send("test", "msg")
+                    @c.publish("test", "msg")
                 end
 
                 it "should use the publish method if it exists" do
                     @connection.expects(:publish).with("test", "msg", {}).once
                     @c.stubs(:msgheaders).returns({})
 
-                    @c.send("test", "msg")
+                    @c.publish("test", "msg")
                 end
 
                 it "should use the send method if publish does not exist" do
@@ -194,14 +194,14 @@ module MCollective
                     @connection.expects(:send).with("test", "msg", {}).once
                     @c.stubs(:msgheaders).returns({})
 
-                    @c.send("test", "msg")
+                    @c.publish("test", "msg")
                 end
 
-                it "should send the correct message to the correct target with 
msgheaders" do
+                it "should publish the correct message to the correct target 
with msgheaders" do
                     @connection.expects(:publish).with("test", "msg", {"test" 
=> "test"}).once
                     @c.expects(:msgheaders).returns({"test" => "test"})
 
-                    @c.send("test", "msg")
+                    @c.publish("test", "msg")
                 end
 
             end
diff --git a/website/changelog.md b/website/changelog.md
index a2a8389..ee739b1 100644
--- a/website/changelog.md
+++ b/website/changelog.md
@@ -11,6 +11,7 @@ title: Changelog
 
 |Date|Description|Ticket|
 |----|-----------|------|
+|2011/05/24|Rename the connector plugins send method to publish to avoid 
issues ruby Object#send|7623|
 |2011/05/23|Log a warning when the CF file parsing fails rather than raise a 
whole ruby exception|7627|
 |2011/05/23|Allow applications to use the exit method as would normally be 
expected|7626|
 |2011/05/22|Refactor subscribe and unsubscribe so that middleware structure is 
entirely contained in the connectors|7620|
-- 
1.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to