consul-templaterb 1.21.8 → 1.22.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
  SHA256:
3
- metadata.gz: 74f293ea13d55d0199e95f0aecb01d30293b52f411e7261328c0a90adbfbd053
4
- data.tar.gz: 310fc6106203eb69db6cc2128e9abdac3c50db3449d952ad0dadba7e3d5501ff
3
+ metadata.gz: 5a383446773f29932a2919164fa521013123aa859be0e6f93141672083261257
4
+ data.tar.gz: 4d8d2916f5d25eba9d9782b5a21b762091df24e1cd7950d250418b12a1da0a46
5
5
  SHA512:
6
- metadata.gz: 5c38462f4d2bff46c5d745ebaf893bf8cae04906c5b416ba6a9574cf570b31fdb5afe612a2991c966eef921ba147c1fee46fba7bbec3cde40bcffb49b39dde47
7
- data.tar.gz: e263ee86afacbf6b2b32b02d7b89dbf8d05d019b24267c52b446719f9eb301cf9ae53d9d017a879f39ef1a5c074e6313062e16c4adb25f53e7f3c49c1260f575
6
+ metadata.gz: e170417393ad454623c8a2d6e67e2d71ee6642f5ab61ca300836406c8892dd0c8852c610d4671f75c887c547134f8ddd046d20952a75149d8ad8e88c5e6f6230
7
+ data.tar.gz: 4ac536f6a1f67f3d43d59829cf0427ecc92176e6adba35956ece9f392c8dcc87a9c68824eb9f1b84e3ed86e043996802aeecd8010ccc0f7cbfbb64a97fbae1f8
data/.travis.yml CHANGED
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.7
4
- - 2.5.6
5
- - 2.6.4
3
+ - 2.4.8
4
+ - 2.5.7
5
+ - 2.6.5
6
+ - 2.7.0
6
7
  jobs:
7
8
  include:
8
9
  - stage: Gem release
9
- rvm: 2.5.6
10
+ rvm: 2.5.7
10
11
  script: echo "Publishing consul-templaterb on rubygems.org ..."
11
12
  deploy:
12
13
  provider: rubygems
data/CHANGELOG.md CHANGED
@@ -2,42 +2,62 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
+ ## 1.22.0 (January 17, 2020)
6
+
7
+ NEW FEATURES:
8
+
9
+ * Fixed compatibility with Ruby 2.7+ (fixes #57)
10
+
5
11
  ## 1.21.8 (January 2, 2020)
6
12
 
7
- * Escape properly metadata containing double quotes in prometheus exporter
13
+ BUGFIX:
14
+
15
+ * Escape properly metadata containing double quotes in prometheus exporter
8
16
 
9
17
  ## 1.21.7 (December 16, 2019)
10
18
 
11
- * Fixed warning color from critical to warning on consul-ui timeline
19
+ IMPROVEMENTS:
20
+
21
+ * Fixed warning color from critical to warning on consul-ui timeline
12
22
 
13
23
  ## 1.21.6 (December 16, 2019)
14
24
 
15
- * Added node_meta_info for serviceInstanceDecorator and serviceMetaDecorator
25
+ IMPROVEMENTS:
26
+
27
+ * Added node_meta_info for serviceInstanceDecorator and serviceMetaDecorator
16
28
 
17
29
  ## 1.21.5 (December 6, 2019)
18
30
 
19
- * Added clean() method in nodes.js to allow nexw behaviors
31
+ NEW FEATURES:
32
+
33
+ * Added clean() method in nodes.js to allow nexw behaviors
20
34
 
21
35
  ## 1.21.4 (November 28, 2019)
22
36
 
23
- * added 2 decorators `navBarDecorator` and `fetchedResponseDecorator`
37
+ NEW FEATURES:
38
+
39
+ * added 2 decorators `navBarDecorator` and `fetchedResponseDecorator`
24
40
 
25
41
  ## 1.21.3 (November 23, 2019)
26
42
 
27
- * added serviceName information for all decorators of services
43
+ IMPROVEMENTS:
44
+
45
+ * added serviceName information for all decorators of services
28
46
 
29
47
  ## 1.21.2 (November 22, 2019)
30
48
 
49
+ IMPROVEMENTS:
50
+
31
51
  * Added instance information into serviceMetaDecorator() calls to
32
52
  allow more sophisticated decorators.
33
53
 
34
54
  ## 1.21.1 (November 22, 2019)
35
55
 
56
+ IMPROVEMENTS:
57
+
36
58
  * Default service meta decorator now decorates http/https links in
37
59
  service meta
38
60
 
39
- NEW FEATURES:
40
-
41
61
  ## 1.21.0 (November 21, 2019)
42
62
 
43
63
  * added function `templates` to list all templates being rendered
@@ -194,26 +214,26 @@ It avoid templates never rendering fully when keys appear/disappear.
194
214
 
195
215
  NEW FEATURES
196
216
 
197
- consul-templaterb now returns an error code whether template is malformed.
198
- This allows to use return code to validate templates when called with `--once`.
217
+ * consul-templaterb now returns an error code whether template is malformed.
218
+ This allows to use return code to validate templates when called with `--once`.
199
219
 
200
220
  IMPROVEMENTS
201
221
 
202
- Do not display ugly stack trace when interrupting program with CRTL-C.
222
+ * Do not display ugly stack trace when interrupting program with CRTL-C.
203
223
 
204
224
  ## 1.14.1 (May 13, 2019)
205
225
 
206
226
  NEW FEATURES
207
227
 
208
- `endpoint.stats.last_modified` allow to display the date at which the data was last modified.
228
+ * `endpoint.stats.last_modified` allow to display the date at which the data was last modified.
209
229
 
210
230
  ## 1.14.0 (May 6, 2019)
211
231
 
212
232
  NEW FEATURES:
213
233
 
214
- When `return nil` is performed in a template, consul-templaterb now considers the template is
215
- not ready and thus do not start any process. It is useful if you want to start a process ONLY
216
- when some conditions are met.
234
+ * When `return nil` is performed in a template, consul-templaterb now considers the template is
235
+ not ready and thus do not start any process. It is useful if you want to start a process ONLY
236
+ when some conditions are met.
217
237
 
218
238
  ## 1.13.1 (April 12, 2019)
219
239
 
@@ -232,7 +252,7 @@ IMPROVEMENTS:
232
252
 
233
253
  NEW FEATURES:
234
254
 
235
- * Windows compatible
255
+ * Windows compatible
236
256
 
237
257
  consul-templaterb now works on Windows.
238
258
 
@@ -240,7 +260,7 @@ consul-templaterb now works on Windows.
240
260
 
241
261
  NEW FEATURES:
242
262
 
243
- * Added new function render_from_string() to render a template from a string (useful with KV)
263
+ * Added new function render_from_string() to render a template from a string (useful with KV)
244
264
 
245
265
  ## 1.10.1 (February 28, 2019)
246
266
 
@@ -288,8 +288,11 @@ STDERR.puts "Max number of descriptors set to #{new_size}" if options[:consul][:
288
288
  # See https://github.com/eventmachine/eventmachine/issues/636#issuecomment-143313282
289
289
  EM.epoll
290
290
 
291
- consul_conf = Consul::Async::ConsulConfiguration.new(options[:consul])
292
- vault_conf = Consul::Async::VaultConfiguration.new(options[:vault])
291
+ # https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
292
+ def ruby2_keywords(*); end if RUBY_VERSION < '2.7'
293
+
294
+ consul_conf = Consul::Async::ConsulConfiguration.new(**options[:consul])
295
+ vault_conf = Consul::Async::VaultConfiguration.new(**options[:vault])
293
296
 
294
297
  ARGV.each do |tpl|
295
298
  dest = compute_default_output(tpl)
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.21.8'.freeze
3
+ VERSION = '1.22.0'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,59 @@
1
+ <%
2
+ # This template compute price of infrastructure
3
+ # based on the kind of machine the software is running on
4
+ # Demo performed during HashiConf 2019
5
+ # https://hashiconf.com/us/schedule/inversion-of-control-with-consul
6
+
7
+ regexp = 'web-.*'
8
+ srv_selector = Regexp.new(regexp)
9
+
10
+ costs = {
11
+ 'unknown' => 8,
12
+ 'base-10g-2018-q-1' => 10,
13
+ 'base-10g-2015' => 9,
14
+ 'base-1g-2013-1' => 5,
15
+ 'base-1g-2015' => 7,
16
+ 'base-1g-2013' => 6,
17
+ 'cpustorage-10g-2018-h-1' => 15,
18
+ 'io-10g-2018-h-1' => 12,
19
+ 'ram-1g-2015' => 8,
20
+ 'ram-10g-2018-q-1' => 9,
21
+ 'storage-10g-2015-1' => 11,
22
+ 'storage-1g-2015-1' => 10,
23
+ 'ssd-10g-2015' => 12,
24
+ 'ram-10g-2015' => 42,
25
+ }
26
+
27
+
28
+ instances = {}
29
+ datacenters.each do |dc|
30
+ services(dc:dc).each do |srv_name, tags|
31
+ if srv_selector.match(srv_name)
32
+ service(srv_name, dc:dc).each do |snode|
33
+ instances[snode['Node']['Node']] = snode
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+
40
+
41
+ result = {
42
+ 'summary' => "Price for #{regexp}",
43
+ 'machines'=> instances.count,
44
+ 'price' => 0,
45
+ 'flavors' => {},
46
+ }
47
+
48
+ instances.each do |name, snode|
49
+ type = snode.service_or_node_meta_value('criteo_flavor')
50
+ flavor_count = result['flavors'][type] || 0
51
+ result['flavors'][type] = flavor_count + 1
52
+ cost = costs[type] || costs['unknown']
53
+ cost += 3 if snode.service_or_node_meta_value('os') == 'windows'
54
+ result['price'] += cost
55
+ end
56
+
57
+ result['unkown_prices_for'] = result['flavors'].select{ |k| costs[k].nil? }
58
+
59
+ %><%= YAML.dump(result) %>
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.21.8
4
+ version: 1.22.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: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request
@@ -224,6 +224,7 @@ files:
224
224
  - samples/consul_template_broken.txt.erb
225
225
  - samples/criteo/haproxy.cfg.erb
226
226
  - samples/debug/compare_connect_services.txt.erb
227
+ - samples/demos/compute_pricing.txt.erb
227
228
  - samples/ha_proxy.cfg.erb
228
229
  - samples/haproxy_dns.cfg.erb
229
230
  - samples/hosts.erb