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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmJiOTk5N2JiNmJhZDlhMDAyNmU2YWNlYjY4NzA4ODljYTVlMWFmMw==
4
+ ZjVhYzdkOThjZjFhNThlZjc2MWUwMzdjZjFiZDkyYmNlMmFjMDA4ZA==
5
5
  data.tar.gz: !binary |-
6
- YzRlZGY4NDQ4ZWYyMTdiMTE0NDc5ZGFhZDA0N2ViZGJjMmM0NzdkYg==
6
+ MjY2MGNlMDNjMzY0NTIxOTk5NjQ4NTcwN2YyMzU3YjRiYTI3NWYxOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTZlODdiZmRlZjE2OTM1OGI3N2ZiMWEwZGU1NzVlZmIzYTIwYzkwMzg4Mjc4
10
- NzNhYzg1M2I2NDhjNmU4M2IyOTYzNWVjZTk3NGM5YmNmYmRlOTVhMzYwMmMw
11
- NTViY2YwNTgwMDUxOTkzMTIzNjI3ODQyYmYwNDQ5NjExNDA4YTE=
9
+ MDg4YjI1OWE4NmQ1YjgzM2RjNmYzYjI1NGRlNDcwZWQ3MGNmMjNhZmJjYTFk
10
+ ZmRiYmFlODZjMThkMzhjZjNmMjA2MzM3MmIxZTBlYmVkZThkZTRhYTY3OTE2
11
+ ZjRmYWVlZmYzN2FiNDk4MGUwNGNkZDBkNDZmNDU0ZGEzMTc4YjI=
12
12
  data.tar.gz: !binary |-
13
- NTM0OWI1ZjVmMzQxMmNiNDc2MjA1OWYyNjgzMzRiYTBmM2Y1YjFhNTVhZmYz
14
- ZDYzNTU5YmZiMmI0NDE1NTBlZTEzZDAxMjExYTM5MGEwMmNmZjM3Zjg4Y2Jl
15
- NjYxZDFiNWJjNjRiZjgzNjUzMDNhMWQ1MjkzNTM2YzA3MWFjMWM=
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 key.to_sym
104
+ when String then
105
+ key.to_sym
104
106
  else key
105
107
  end
106
108
  new_value = case value
@@ -23,6 +23,6 @@
23
23
 
24
24
  class Chef
25
25
  module RABBIT
26
- VERSION = "1.0.5"
26
+ VERSION = "1.0.6"
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-rabbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - MTN Satellite Communications