chef-rabbit 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/chef/rabbit.rb +8 -6
- data/lib/chef/rabbit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjVhYzdkOThjZjFhNThlZjc2MWUwMzdjZjFiZDkyYmNlMmFjMDA4ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjY2MGNlMDNjMzY0NTIxOTk5NjQ4NTcwN2YyMzU3YjRiYTI3NWYxOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDg4YjI1OWE4NmQ1YjgzM2RjNmYzYjI1NGRlNDcwZWQ3MGNmMjNhZmJjYTFk
|
10
|
+
ZmRiYmFlODZjMThkMzhjZjNmMjA2MzM3MmIxZTBlYmVkZThkZTRhYTY3OTE2
|
11
|
+
ZjRmYWVlZmYzN2FiNDk4MGUwNGNkZDBkNDZmNDU0ZGEzMTc4YjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGVmZjcyNmRjZThjYjg0OTI0YTJjNzkyZTliNzA3YjA0OGQzYTkwMmI1OTQ2
|
14
|
+
OTE5NThhMGFjYjMwMGY2MTllYmVjMDBjOTM5MTVkZDdmNWNlZWYxZmE0ZTQ4
|
15
|
+
MDA0ZTRhYzJlOTAyMGVhMDBhMmQ2NDhiZDIyNjIwZjliMzY0ODM=
|
data/lib/chef/rabbit.rb
CHANGED
@@ -16,7 +16,6 @@ require "chef/handler"
|
|
16
16
|
class Chef
|
17
17
|
module RABBIT
|
18
18
|
class Handler < Chef::Handler
|
19
|
-
attr_reader :connection
|
20
19
|
attr_reader :options
|
21
20
|
|
22
21
|
def options=(value = {})
|
@@ -42,15 +41,15 @@ class Chef
|
|
42
41
|
|
43
42
|
def initialize(options = {})
|
44
43
|
self.options = symbolize_keys(options)
|
45
|
-
|
46
|
-
Chef::Log.debug "Initialised RABBIT handler for amqp://#{self.options[:connection][:user]}:#{self.options[:connection][:pass]}@#{self.options[:connection][:host]}:#{self.options[:connection][:port]}/#{self.options[:connection][:vhost]}"
|
47
|
-
@connection = Bunny.new(self.options[:connection])
|
48
|
-
@connection.start
|
49
44
|
end
|
50
45
|
|
51
46
|
def report
|
52
47
|
Chef::Log.debug "Reporting #{run_status.inspect}"
|
53
48
|
Chef::Log.debug "Options for RABBIT handler are: #{@options.pretty_inspect}"
|
49
|
+
connection = Bunny.new(self.options[:connection])
|
50
|
+
connection.start
|
51
|
+
|
52
|
+
Chef::Log.debug "Initialised RABBIT handler for amqp://#{self.options[:connection][:user]}:#{self.options[:connection][:pass]}@#{self.options[:connection][:host]}:#{self.options[:connection][:port]}#{self.options[:connection][:vhost]}"
|
54
53
|
|
55
54
|
channel = @connection.create_channel
|
56
55
|
exchange = (@options[:exchange] == nil) ? channel.default_exchange : channel.direct(@options[:exchange][:name], @options[:exchange][:params])
|
@@ -77,6 +76,8 @@ class Chef
|
|
77
76
|
}.to_json,
|
78
77
|
:routing_key => @options[:queue][:name])
|
79
78
|
end
|
79
|
+
|
80
|
+
connection.close
|
80
81
|
end
|
81
82
|
|
82
83
|
def changes
|
@@ -100,7 +101,8 @@ class Chef
|
|
100
101
|
def symbolize_keys(hash)
|
101
102
|
hash.inject({}) {|result, (key, value)|
|
102
103
|
new_key = case key
|
103
|
-
when String then
|
104
|
+
when String then
|
105
|
+
key.to_sym
|
104
106
|
else key
|
105
107
|
end
|
106
108
|
new_value = case value
|
data/lib/chef/rabbit/version.rb
CHANGED