pushyd 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ba6f2c7c7310e2767380a940d9c7416f1ac87fc
4
- data.tar.gz: c9db478c51b6d7f77bb385bcb96e847181b9ca86
3
+ metadata.gz: b4b7747634e7a6e9d73b5247b453168994d6f642
4
+ data.tar.gz: 9731350abaec6a877a8a300fc5bb9906141431e9
5
5
  SHA512:
6
- metadata.gz: d7dcb8428586078ce08b30c7ce978d377c71889af1ae745ca00490288724dc9dd2830ef36fe5c2f85e01063a5637dd270110e4fa851a203ea6e97a03257810a2
7
- data.tar.gz: 0f7156adeb70165a7753fa7d676db908b6aaf4d918b70f50e892234517264c5cbfd6a0cea35c80e498ee9b42148596c8dccad157dce3ffc4b77cbb9bce9980f0
6
+ metadata.gz: 3908366de3c57747703d9734b815507f63c6bb9f29e9f7475ec68170d7f4ced9147d986e1dabcd0a5d45b0a34d41ef6a8f8f3f9d75e20e4b055d40aead8e5e52
7
+ data.tar.gz: 04f876be6118ef9c0211d44b8f98aa3f8af0cf9251a0bb8dd7146eb6492bd371f50c526923e8b64a5dfd7e5df866df0fbcc972bb0f345c5aac567e05e97a814b
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pushyd (0.23.0)
4
+ pushyd (0.24.0)
5
5
  api-auth
6
- bmc-daemon-lib (~> 0.5.0)
6
+ bmc-daemon-lib (~> 0.5.1)
7
7
  bunny (~> 2.3)
8
8
  daemons
9
9
  json
@@ -15,11 +15,12 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- addressable (2.4.0)
18
+ addressable (2.5.0)
19
+ public_suffix (~> 2.0, >= 2.0.2)
19
20
  amq-protocol (2.0.1)
20
21
  api-auth (2.0.1)
21
22
  ast (2.3.0)
22
- bmc-daemon-lib (0.5.0)
23
+ bmc-daemon-lib (0.5.1)
23
24
  chamber (~> 2.9.1)
24
25
  bunny (2.6.1)
25
26
  amq-protocol (>= 2.0.1)
@@ -28,7 +29,7 @@ GEM
28
29
  thor (~> 0.19.1)
29
30
  daemons (1.2.4)
30
31
  diff-lcs (1.2.5)
31
- domain_name (0.5.20160826)
32
+ domain_name (0.5.20161021)
32
33
  unf (>= 0.0.5, < 1.0.0)
33
34
  hashie (3.4.6)
34
35
  http (2.0.3)
@@ -48,6 +49,7 @@ GEM
48
49
  parser (2.3.1.4)
49
50
  ast (~> 2.2)
50
51
  powerpack (0.1.1)
52
+ public_suffix (2.0.4)
51
53
  rainbow (2.1.0)
52
54
  rake (11.3.0)
53
55
  rest-client (1.8.0)
@@ -69,7 +71,7 @@ GEM
69
71
  diff-lcs (>= 1.2.0, < 2.0)
70
72
  rspec-support (~> 3.5.0)
71
73
  rspec-support (3.5.0)
72
- rubocop (0.44.1)
74
+ rubocop (0.45.0)
73
75
  parser (>= 2.3.1.1, < 3.0)
74
76
  powerpack (~> 0.1)
75
77
  rainbow (>= 1.99.1, < 3.0)
data/bin/pushyd CHANGED
@@ -42,9 +42,9 @@ begin
42
42
  Conf[:logs][:file] = cmd_logfile.to_s if cmd_logfile
43
43
 
44
44
  rescue OptionParser::InvalidOption => e
45
- abort "EXITING: InvalidOption: #{e.message} \n #{e.backtrace.to_yaml}"
45
+ abort "EXITING: InvalidOption: #{e.message}"
46
46
  rescue ConfigParseError => e
47
- abort "EXITING: ConfigParseError: #{e.message} \n #{e.backtrace.to_yaml}"
47
+ abort "EXITING: ConfigParseError: #{e.message}"
48
48
  rescue StandardError => e
49
49
  abort "EXITING: StandardError: #{e.message} \n #{e.backtrace.to_yaml}"
50
50
  else
data/lib/pushyd/proxy.rb CHANGED
@@ -12,13 +12,13 @@ module PushyDaemon
12
12
 
13
13
  def initialize
14
14
  # Init
15
- @shouters = []
15
+ @shouter = nil
16
16
  @consumers = []
17
17
 
18
18
  # Init ASCII table
19
19
  @table = Terminal::Table.new
20
- @table.title = "Propagation rules"
21
- @table.headings = ["rule", "topic", "route", "relay", "created queue", "description"]
20
+ @table.title = "Rules summary"
21
+ @table.headings = ["rule", "topic", "route", "relay", "description", "status"]
22
22
  @table.align_column(5, :right)
23
23
 
24
24
  # Prepare logger
@@ -28,6 +28,9 @@ module PushyDaemon
28
28
  @conn = connect_to BmcDaemonLib::Conf[:broker]
29
29
  log_info "Proxy connected"
30
30
 
31
+ # Create a new shouter
32
+ @shouter = create_shouter
33
+
31
34
  # Check config and subscribe rules
32
35
  create_consumers
33
36
 
@@ -35,19 +38,21 @@ module PushyDaemon
35
38
  log_info "Proxy initialized", @table.to_s
36
39
  puts @table.to_s
37
40
 
41
+ # Make the shouter loop!
42
+ @shouter.start_loop
38
43
 
39
- # Create a new shouter, and start its loop
40
- create_shouter
44
+ rescue BmcDaemonLib::MqConsumerException => e
45
+ log_error "Proxy consumer: #{e.message}"
46
+ abort "EXITING #{e.class}: #{e.message}"
41
47
 
42
- rescue BmcDaemonLib::MqConsumerException, EndpointConnectionError, ShouterInterrupted, Errno::EACCES => e
43
- log_error "Proxy: #{e.message}"
48
+ rescue ShouterInterrupted, EndpointConnectionError, Errno::EACCES => e
49
+ log_error "Proxy error: #{e.message}"
44
50
  abort "EXITING #{e.class}: #{e.message}"
45
51
 
46
52
  rescue StandardError => e
47
- log_error "Proxy: #{e.message}", e.backtrace
53
+ log_error "Proxy unexpected: #{e.message}", e.backtrace
48
54
  abort "EXITING #{e.class}: #{e.message} \n #{e.backtrace.to_yaml}"
49
-
50
- raise MqConsumerException, e.message
55
+ # raise MqConsumerException, e.message
51
56
 
52
57
  end
53
58
 
@@ -65,11 +70,7 @@ module PushyDaemon
65
70
  config_shouter = BmcDaemonLib::Conf[:shout]
66
71
 
67
72
  # Create the shouter
68
- shouter = Shouter.new(@conn, config_shouter)
69
- @shouters << shouter
70
-
71
- # Now make it loop
72
- shouter.start_loop
73
+ Shouter.new(@conn, config_shouter)
73
74
  end
74
75
 
75
76
  def create_consumers
@@ -84,7 +85,7 @@ module PushyDaemon
84
85
  # Subscribe for each and every rule/route
85
86
  config_rules.each do |name, rule|
86
87
  rule[:name] = name
87
- create_consumer rule
88
+ @consumers << create_consumer(rule)
88
89
  end
89
90
  end
90
91
 
@@ -102,19 +103,25 @@ module PushyDaemon
102
103
  # Build a new consumer
103
104
  consumer = Consumer.new(@conn, rule_name, rule)
104
105
 
105
- # Create its own queue
106
+ # Subscribe to my own queue
106
107
  consumer.subscribe_to_queue rule_queue, "rule:#{rule_name}"
107
108
 
108
109
  # Bind each route to exchange
109
110
  rule_routes.each do |route|
110
- consumer.listen_to rule_topic, route
111
+ begin
112
+ status = "> #{rule_queue}"
113
+ consumer.listen_to rule_topic, route
114
+ rescue BmcDaemonLib::MqConsumerTopicNotFound => e
115
+ status = "! BIND FAILED"
116
+ log_error "Proxy consumer: #{e.message}"
117
+ end
111
118
 
112
119
  # Add row to config table
113
- @table.add_row [rule_name, rule_topic, route, rule[:relay].to_s, rule_queue, rule[:title].to_s ]
120
+ @table.add_row [rule_name, rule_topic, route, rule[:relay].to_s, rule[:title].to_s, status ]
114
121
  end
115
122
 
116
- # Return it
117
- @consumers << consumer
123
+ # Return consumer
124
+ consumer
118
125
  end
119
126
 
120
127
  def consumer_cancelled all={}
data/pushyd.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.23.0"
4
+ spec.version = "0.24.0"
5
5
 
6
6
  # Project description
7
7
  spec.name = "pushyd"
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  # spec.add_development_dependency "pry"
29
29
 
30
30
  # Runtime dependencies
31
- spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.5.0"
31
+ spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.5.1"
32
32
  spec.add_runtime_dependency "daemons"
33
33
  spec.add_runtime_dependency "json"
34
34
  spec.add_runtime_dependency "bunny", "~> 2.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushyd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2016-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.5.0
89
+ version: 0.5.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.5.0
96
+ version: 0.5.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: daemons
99
99
  requirement: !ruby/object:Gem::Requirement