skalera-services 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skalera/services/controllers.rb +28 -0
- data/lib/skalera/services/version.rb +1 -1
- data/lib/skalera/services.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30a722a2ad3ab8f3a35f1be649daa95562ab50bd
|
4
|
+
data.tar.gz: 9c71d1e0e63fa739cf74a3e9af1022c1b3cca1b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f724236ef316e4649dba08c0a41b05b3d400cffe9db2ea11357823d3dd252c1cb8c57923272457ab4bcbe232fb49eb0b427aeb8197f93b3cd5ba7e6adb1b17
|
7
|
+
data.tar.gz: 3c7664f866fe4a18e0a5282264355edcf883765b5da6b19412920841bc2737db76d0a18504c7569370a36c76d5dceb12829339861cb66d8ed43273bb7dacbcf7
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'diplomat'
|
2
|
+
|
3
|
+
module Skalera
|
4
|
+
module Services
|
5
|
+
class Controllers
|
6
|
+
def self.for(controller_uuid)
|
7
|
+
controllers = Diplomat::Kv.get("controllers/#{controller_uuid}", recurse: true)
|
8
|
+
host = extract(controllers, 'address')
|
9
|
+
port = extract(controllers, 'port')
|
10
|
+
[host['address'], port['port']]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.extract(controllers, field)
|
14
|
+
result = {}
|
15
|
+
controllers.select { |c| c[:key].match(%r{/#{field}}) }.each do |hash|
|
16
|
+
host = hash[:key].sub(%r{controllers/}, '').split('/')[1]
|
17
|
+
result[host] = hash[:value]
|
18
|
+
end
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.add(controller_uuid, host, port)
|
23
|
+
Diplomat::Kv.put("controllers/#{controller_uuid}/address", host)
|
24
|
+
Diplomat::Kv.put("controllers/#{controller_uuid}/port", port)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/skalera/services.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skalera-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Englund
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- lib/skalera/services.rb
|
244
244
|
- lib/skalera/services/airbrake.rb
|
245
245
|
- lib/skalera/services/consul.rb
|
246
|
+
- lib/skalera/services/controllers.rb
|
246
247
|
- lib/skalera/services/credentials.rb
|
247
248
|
- lib/skalera/services/errbit.rb
|
248
249
|
- lib/skalera/services/influxdb.rb
|