From c87d6c98ec1a315d435be38e7eb2258984c7d88c Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Wed, 20 Apr 2011 02:35:40 +1000 Subject: Fixed #7166 - Replaced deprecated stomp "send" method with "publish" The "send" method in the stomp gem has been deprecated since: http://gitorious.org/stomp/mainline/commit/d542a976028cb4c5badcbb69e3383e746721e44c It's been replaced with the "publish" method. Also renamed the send_message method to publish_message more in keeping with language used in queuing. --- lib/puppet/util/queue.rb | 2 +- lib/puppet/util/queue/stomp.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/puppet/util') diff --git a/lib/puppet/util/queue.rb b/lib/puppet/util/queue.rb index 02357742a..636bdcf2e 100644 --- a/lib/puppet/util/queue.rb +++ b/lib/puppet/util/queue.rb @@ -30,7 +30,7 @@ require 'puppet/util/instance_loader' # # The client plugins are expected to implement an interface similar to that of Stomp::Client: # * new should return a connected, ready-to-go client instance. Note that no arguments are passed in. -# * send_message(queue, message) should send the _message_ to the specified _queue_. +# * publish_message(queue, message) should publish the _message_ to the specified _queue_. # * subscribe(queue) _block_ subscribes to _queue_ and executes _block_ upon receiving a message. # * _queue_ names are simple names independent of the message broker or client library. No "/queue/" prefixes like in Stomp::Client. module Puppet::Util::Queue diff --git a/lib/puppet/util/queue/stomp.rb b/lib/puppet/util/queue/stomp.rb index c18edae6a..cabc56627 100644 --- a/lib/puppet/util/queue/stomp.rb +++ b/lib/puppet/util/queue/stomp.rb @@ -28,8 +28,8 @@ class Puppet::Util::Queue::Stomp end end - def send_message(target, msg) - stomp_client.send(stompify_target(target), msg, :persistent => true) + def publish_message(target, msg) + stomp_client.publish(stompify_target(target), msg, :persistent => true) end def subscribe(target) -- cgit From a0de3288bad113c9be1190095b03e892e17000d2 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 21 Apr 2011 14:46:36 -0700 Subject: (#6928) backport Symbol#to_proc for Ruby < 1.8.7 We use the &:foo symbol-to-proc syntax in some of our code, so to avoid problems on Ruby earlier than 1.8.7 we should backport the support in our monkey-patch file. Reviewed-By: Max Martin --- lib/puppet/util/monkey_patches.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/puppet/util') diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 10a268409..9ae0ca6a2 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -104,3 +104,12 @@ class Array end end unless method_defined? :combination end + + +if Symbol.instance_method(:to_proc).nil? + class Symbol + def to_proc + Proc.new { |*args| args.shift.__send__(self, *args) } + end + end +end -- cgit From de2199f3666ca9e26a0a36ec17b176300a4fa599 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 21 Apr 2011 15:01:38 -0700 Subject: (#6928) Don't blow up when the method is undefined... Use the same model for testing instance methods as the rest of the code. Reviewed-By: Max Martin --- lib/puppet/util/monkey_patches.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/puppet/util') diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 9ae0ca6a2..bd954c665 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -106,10 +106,8 @@ class Array end -if Symbol.instance_method(:to_proc).nil? - class Symbol - def to_proc - Proc.new { |*args| args.shift.__send__(self, *args) } - end - end +class Symbol + def to_proc + Proc.new { |*args| args.shift.__send__(self, *args) } + end unless method_defined? :to_proc end -- cgit