etcd-discovery 0.0.7 → 0.0.8
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 +4 -4
- data/lib/etcd-discovery.rb +7 -1
- data/lib/etcd-discovery/host.rb +1 -1
- data/lib/etcd-discovery/service.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b8a43d02a8039190280e3339fc2a75e0bf17a6f
|
4
|
+
data.tar.gz: fd06a67c3c878a3a0732ba5362b804fae70b4cd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db73871e90d971d6bdc2cdeccf5499df32392536b716b188dc1087b340fa7d7c8fdd987fa7cf5ed18bcc3ce45dad55d3ccbc4f09ed004343200835e6219017d1
|
7
|
+
data.tar.gz: f6a0ec5790eaa580e4f168b54c1d78b6bf08850228e78872f320e33ea2d0cb8fcc60d2c9647d28dbc71efcb190d1722ce8f2a882ba4b1990396402f5180f1272
|
data/lib/etcd-discovery.rb
CHANGED
@@ -26,6 +26,12 @@ module EtcdDiscovery
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.register(service, host)
|
29
|
-
Thread.new {
|
29
|
+
Thread.new {
|
30
|
+
begin
|
31
|
+
Service.register(service, host)
|
32
|
+
rescue => e
|
33
|
+
puts "Fail to register #{service}: #{e.class} #{e} #{e.backtrace}"
|
34
|
+
end
|
35
|
+
}
|
30
36
|
end
|
31
37
|
end
|
data/lib/etcd-discovery/host.rb
CHANGED
@@ -13,7 +13,7 @@ module EtcdDiscovery
|
|
13
13
|
else
|
14
14
|
raise TypeError, "requires a Etcd::Node or a Hash, not a #{arg.class}"
|
15
15
|
end
|
16
|
-
if !attributes.has_key?
|
16
|
+
if !attributes.has_key?('name') or !attributes.has_key?('port')
|
17
17
|
raise InvalidHost, "attributes 'name' and 'port' should be defined"
|
18
18
|
end
|
19
19
|
attributes['user'] = "" if attributes['user'].nil?
|
@@ -37,7 +37,7 @@ module EtcdDiscovery
|
|
37
37
|
value = h.to_json
|
38
38
|
|
39
39
|
while true
|
40
|
-
client.set("/services/#{service}/#{h.
|
40
|
+
client.set("/services/#{service}/#{h.attributes['name']}", value: value, ttl: config.register_ttl)
|
41
41
|
sleep config.register_renew
|
42
42
|
end
|
43
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etcd-discovery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Léo Unbekandt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: etcd
|