consul-templaterb 1.14.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 19a9fb526bba0cc83b770850eeedca78809be239be8c59389c0bdfc9ddcaa101
4
- data.tar.gz: a74807d9c5fff6f2dbf00379fa3cabe737f872d75a40503e05b7e9d8b2a94997
2
+ SHA1:
3
+ metadata.gz: 5683a9f5392630b3d6579fa02f0f7d29947287a9
4
+ data.tar.gz: f5f80b967020d8a6ee0e8bfd4b106f369335313c
5
5
  SHA512:
6
- metadata.gz: 72254dd5e093eb975fab39945b3ba0486473bcca668c955adc7aac56aa421b5b1827c78a50a1173e9949ebfb075235fef83a4ebcf14fccbc24c36aacc8c9019e
7
- data.tar.gz: 44d8d212a1fad75022916f5cf64568415ef3f1f1b37baa89f1a4e9680379c34e9eea587f281634032b9df9a4a4254fe1e0210665b591e165e118f7c2c26f0b6d
6
+ metadata.gz: 942b22b9f18e721dcc36bd085ea324d224492d0e8e9dd0903009d8e04f261238505400a95ca5626ef60751e4d7a78ded148c96c6ed6993f1b40da17930647571
7
+ data.tar.gz: f3a80693d9302686c78285c5e85103a7085884178849d32954f1c67d85335ead7ec9e2a0cd94c2e9fe849fdc0ba8f8cf2929a51051af8ffea8ecc277eccc8553
data/CHANGELOG.md CHANGED
@@ -2,11 +2,22 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
+ ## 1.15.0 (May 14, 2019)
6
+
7
+ NEW FEATURES
8
+
9
+ consul-templaterb now returns an error code whether template is malformed.
10
+ This allows to use return code to validate templates when called with `--once`.
11
+
12
+ IMPROVEMENTS
13
+
14
+ Do not display ugly stack trace when interrupting program with CRTL-C.
15
+
5
16
  ## 1.14.1 (May 13, 2019)
6
17
 
7
18
  NEW FEATURES
8
19
 
9
- `endpoint.stats.last_modified` allow to display the date at which the data was last_modified.
20
+ `endpoint.stats.last_modified` allow to display the date at which the data was last modified.
10
21
 
11
22
  ## 1.14.0 (May 6, 2019)
12
23
 
@@ -254,7 +254,6 @@ def kill_program
254
254
  v.kill
255
255
  end
256
256
  @programs = {}
257
- exit 0
258
257
  end
259
258
 
260
259
  optparse.parse!
@@ -298,16 +297,17 @@ end
298
297
  Signal.trap('USR1', 'IGNORE') unless Gem.win_platform?
299
298
  # Ensure to kill child process if any
300
299
  ['EXIT'].each do |sig|
301
- Signal.trap(sig) do
302
- STDERR.puts "[KILL] received #{sig}, stopping myself"
300
+ Signal.trap(sig) do |signo|
301
+ STDERR.puts "[KILL] received #{Signal.signame(signo)}, stopping myself"
303
302
  template_manager.terminate
304
303
  kill_program
305
304
  end
306
305
  end
307
306
 
308
- consul_engine.run(template_manager)
309
-
310
- # Kill possible child process if consul_engine.run did stop
311
- kill_program
307
+ begin
308
+ consul_engine.run(template_manager)
309
+ rescue Interrupt => e
310
+ STDERR.puts "[WARN] consul-templaterb has been interrupted #{e}"
311
+ end
312
312
 
313
- exit 0
313
+ exit consul_engine.result
@@ -9,7 +9,7 @@ require 'erb'
9
9
  module Consul
10
10
  module Async
11
11
  class ConsulTemplateEngine
12
- attr_reader :template_manager, :hot_reload_failure, :template_frequency, :debug_memory
12
+ attr_reader :template_manager, :hot_reload_failure, :template_frequency, :debug_memory, :result
13
13
  attr_writer :hot_reload_failure, :template_frequency, :debug_memory
14
14
  def initialize
15
15
  @templates = []
@@ -19,6 +19,7 @@ module Consul
19
19
  @template_frequency = 1
20
20
  @periodic_started = false
21
21
  @debug_memory = false
22
+ @result = 0
22
23
  @last_memory_state = build_memory_info
23
24
  @start = Time.now
24
25
  end
@@ -60,10 +61,12 @@ module Consul
60
61
  rescue Consul::Async::InvalidTemplateException => e
61
62
  STDERR.puts "[FATAL]#{e}"
62
63
  template_manager.terminate
64
+ @result = 1
63
65
  EventMachine.stop
64
66
  rescue StandardError => e
65
67
  STDERR.puts "[FATAL] Error occured: #{e.inspect} - #{e.backtrace.join("\n\t")}"
66
68
  template_manager.terminate
69
+ @result = 2
67
70
  EventMachine.stop
68
71
  end
69
72
 
@@ -111,6 +114,7 @@ module Consul
111
114
  end
112
115
  end
113
116
  end
117
+ @result
114
118
  end
115
119
  end
116
120
  end
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.14.1'.freeze
3
+ VERSION = '1.15.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-templaterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.1
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SRE Core Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2019-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request
@@ -242,7 +242,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  requirements: []
245
- rubygems_version: 3.0.3
245
+ rubyforge_project:
246
+ rubygems_version: 2.6.14.4
246
247
  signing_key:
247
248
  specification_version: 4
248
249
  summary: Implementation of Consul template using Ruby and .erb templating language