etcd-tools 0.4.2 → 0.4.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 +8 -8
- data/lib/etcd-tools/cli/etcd2yaml.rb +1 -1
- data/lib/etcd-tools/cli/etcd_erb.rb +1 -1
- data/lib/etcd-tools/cli/yaml2etcd.rb +1 -1
- data/lib/etcd-tools/etcd.rb +1 -3
- data/lib/etcd-tools/mixins/etcd.rb +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjQ3OTQ5ZDg5MmM1MzgxY2E3MTE4YzhjNDI5NzRmZmZkMDQxMWUwYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDNmZjQyMWE1NjcwOGYxMjNmMTBkMzcxMjU1OWIyODVlZWVkY2FhZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjFkOWRmZmFjYmQ3MDI1ZjVmY2NlZWQyOWY3NWI1NTU1MjY4M2E3ODYyOGY2
|
10
|
+
YTA4OTI5YmIxMTFiNjMxNGUzMWQyYjQ2ZmRkMThlMTI3YzlmYjljYjI4MmQ3
|
11
|
+
ODY1Y2UwYTc0YmNhZjNkODk4MTkyYmE0ODIyODkwNjBkN2QxODM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmFmNzYwZDVhNjljNTViZTRiOGYxZGRhOTk5MjhlNDA1YzM5MmUyZWRlNmJm
|
14
|
+
YmU5NDgxZDM2MGUwNzc1MDFlY2RmYzc0NDhjZWY4ODFjYTIzZTRjYmZkOWMw
|
15
|
+
MTU1NjI1NjQ1Y2YxN2RiMTE0NWFiYzA5MTc5ODMyMDdiY2NmNDQ=
|
data/lib/etcd-tools/etcd.rb
CHANGED
@@ -2,8 +2,6 @@ require 'etcd'
|
|
2
2
|
require 'etcd-tools/mixins'
|
3
3
|
|
4
4
|
module EtcdTools
|
5
|
-
class ClusterConnectError < Exception
|
6
|
-
end
|
7
5
|
|
8
6
|
module Etcd
|
9
7
|
def etcd_connect(url, timeout = 2)
|
@@ -14,7 +12,7 @@ module EtcdTools
|
|
14
12
|
next unless etcd.healthy?
|
15
13
|
return etcd
|
16
14
|
end
|
17
|
-
raise
|
15
|
+
raise Etcd::ClusterConnectError
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -2,6 +2,9 @@ require 'etcd'
|
|
2
2
|
require 'etcd/client'
|
3
3
|
|
4
4
|
module Etcd
|
5
|
+
class ClusterConnectError < RuntimeError
|
6
|
+
end
|
7
|
+
|
5
8
|
class Client
|
6
9
|
|
7
10
|
attr_reader :cluster
|
@@ -42,6 +45,7 @@ module Etcd
|
|
42
45
|
end
|
43
46
|
|
44
47
|
def cluster_http_request(req, options={})
|
48
|
+
errs = []
|
45
49
|
cluster.each do |member|
|
46
50
|
http = build_http_object(member[:host], member[:port], options)
|
47
51
|
begin
|
@@ -50,18 +54,21 @@ module Etcd
|
|
50
54
|
Log.debug("Response code: #{res.code}")
|
51
55
|
Log.debug("Response body: #{res.body}")
|
52
56
|
return process_http_request(res)
|
53
|
-
rescue Timeout::Error
|
57
|
+
rescue Timeout::Error => e
|
54
58
|
Log.debug("Connection timed out on #{member[:host]}:#{member[:host]}")
|
59
|
+
errs << e
|
55
60
|
next
|
56
|
-
rescue Errno::ECONNRESET
|
61
|
+
rescue Errno::ECONNRESET => e
|
57
62
|
Log.debug("Connection reset on #{member[:host]}:#{member[:host]}")
|
63
|
+
errs << e
|
58
64
|
next
|
59
|
-
rescue Errno::ECONNREFUSED
|
65
|
+
rescue Errno::ECONNREFUSED => e
|
60
66
|
Log.debug("Connection refused on #{member[:host]}:#{member[:host]}")
|
67
|
+
errs << e
|
61
68
|
next
|
62
69
|
end
|
63
70
|
end
|
64
|
-
fail "Couldn't connect to the
|
71
|
+
fail(Etcd::ClusterConnectError, "Couldn't connect to the ETCD cluster: #{errs.map(&:class).map(&:to_s)}")
|
65
72
|
end
|
66
73
|
|
67
74
|
def build_http_object(host, port, options={})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etcd-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radek 'blufor' Slavicinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: etcd
|