consul-templaterb 1.5.2 → 1.5.3

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
2
  SHA256:
3
- metadata.gz: 0b4a47eabba659837253d921211008b5e44d625f6b0229d38da9dfbdfe2570b4
4
- data.tar.gz: 5bfae8c915b2a263f6f5e3d9867f48e1b43abb6a7bcba5e31754efdb5a6c905b
3
+ metadata.gz: 108f2c7ab2a9ad7a5153a9bb0589a5964da4cc6c87354fd8b09504bfde519431
4
+ data.tar.gz: 7307427ef26bc8e0fec2d38ea64568d327d5df18a530b092d97e71ce14d736cd
5
5
  SHA512:
6
- metadata.gz: e6f34ac0190a98f5a27e1250a2c8c4aa7c49687857337e83ac7cd02bd4c3659e367e821805cec08625ad42a797419018d707fdccdede1a15bf879a259d346e86
7
- data.tar.gz: aef9aaa4acab258920984b042333e1190a49f50d0ec67f0e4c86613e1adcc908c7899dce9922da2395e3efb07404e5be32e887d66ee3d89790d861298fc64db0
6
+ metadata.gz: 0791904a177e227316c3c4e062ec1291620dd1e067ac5a3a80f172df501dbd2f902ba747841d2b94b53903bd5ee3ddaa6a33cdbf553f2d730b71af696ff98fb6
7
+ data.tar.gz: 8c305969be4be2eef1b726ef7ea04dd0d28a0a3861aa05dd08e54911207461e3c696949b029ea4a46d4a603772946d93b115aa4b8f33f3f75e92338e6a9058b8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
+ ## 1.5.2 (September 24, 2018)
6
+
7
+ * added to_a method to Arrays
8
+ * Improved Consul-UI templates to have proper list of DCs
9
+
5
10
  ## 1.5.2 (September 12, 2018)
6
11
 
7
12
  IMPROVEMENTS:
@@ -285,13 +285,14 @@ module Consul
285
285
  end
286
286
 
287
287
  class ConsulTemplateAbstractMap < ConsulTemplateAbstract
288
- def_delegators :result_delegate, :each, :[], :keys, :sort, :values, :each_pair, :each_value
288
+ def_delegators :result_delegate, :each, :[], :keys, :sort, :select, :values, :each_pair, :each_value, :count, :empty?, :map
289
289
  def initialize(consul_endpoint)
290
290
  super(consul_endpoint)
291
291
  end
292
292
  end
293
293
 
294
294
  class ConsulTemplateAbstractArray < ConsulTemplateAbstract
295
+ def_delegators :result_delegate, :each, :[], :sort, :select, :each_value, :count, :empty?, :map, :to_a
295
296
  def initialize(consul_endpoint)
296
297
  super(consul_endpoint)
297
298
  end
@@ -67,10 +67,6 @@ class Endpoint
67
67
  req
68
68
  end
69
69
 
70
- def log(level, message)
71
-
72
- end
73
-
74
70
  def _handle_error(http, consul_index)
75
71
  retry_in = [600, conf.retry_duration + 2**@consecutive_errors].min
76
72
  STDERR.puts "[ERROR][#{path}] X-Consul-Index:#{consul_index} - #{http.error} - Retry in #{retry_in}s #{stats.body_bytes_human}"
@@ -85,8 +81,8 @@ class Endpoint
85
81
 
86
82
  def fetch
87
83
  options = {
88
- connect_timeout: 5, # default connection setup timeout
89
- inactivity_timeout: conf.wait_duration + 1, # default connection inactivity (post-setup) timeout
84
+ connect_timeout: 5, # default connection setup timeout
85
+ inactivity_timeout: conf.wait_duration + 1, # default connection inactivity (post-setup) timeout
90
86
  }
91
87
  connection = EventMachine::HttpRequest.new(conf.base_url, options)
92
88
  cb = proc do |consul_index|
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.5.2'.freeze
3
+ VERSION = '1.5.3'.freeze
4
4
  end
5
5
  end
@@ -59,6 +59,6 @@
59
59
  end
60
60
  end
61
61
  %><%
62
- json_datacenters = datacenters
62
+ json_datacenters = datacenters.to_a
63
63
  json = { nodes: service_per_node, datacenters: json_datacenters, generated_at: Time.now}
64
64
  %><%= JSON.pretty_generate(json) %>
@@ -94,6 +94,6 @@
94
94
  service[:instances] << server
95
95
  end
96
96
  end
97
- json_datacenters = datacenters
97
+ json_datacenters = datacenters.to_a
98
98
  json = { services: json_backends, datacenters: json_datacenters, generated_at: Time.now}
99
99
  %><%= JSON.pretty_generate(json) %>
@@ -42,7 +42,14 @@
42
42
  <%
43
43
  else
44
44
  json = JSON.parse(Base64.decode64(tuple['Value']))
45
- holders = json['holders']
45
+ begin
46
+ holders = json['holders']
47
+ rescue StandardError => e
48
+ %>
49
+ <h1>Failed to parse holders <%= e %> in <%= json %></h1>
50
+ <%
51
+ holders = []
52
+ end
46
53
  end
47
54
  %>
48
55
  <% if holders.count > 0 %>
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.5.2
4
+ version: 1.5.3
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: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request