consul_syncer 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/consul_syncer.rb +8 -5
- data/lib/consul_syncer/endpoint.rb +4 -0
- data/lib/consul_syncer/version.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: 84bf7af4ae453bd70d421f22046be75e50430646
|
4
|
+
data.tar.gz: 88a811c044da4d8593ee992d2539164900fc6c84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09009163e3d55da5f45d4ec94f12e77aa0e6bf5203cec8bbe33c6bb029da76c96c2eadc8cf61ec77ce8e4ed012921d7001af7f9cb2c68ee374cad169b1f289a6
|
7
|
+
data.tar.gz: 1de658780985b5e9424b6498e6d1ff2214769606a3c079c68bef241c672f7f636ec6db588772a7127626418666ca12c7f2ac5e3b670caaa3b378f169c4afde8d
|
data/lib/consul_syncer.rb
CHANGED
@@ -34,16 +34,17 @@ class ConsulSyncer
|
|
34
34
|
address: consul_endpoint.ip,
|
35
35
|
service: consul_endpoint.name,
|
36
36
|
service_id: consul_endpoint.service_id,
|
37
|
+
service_address: consul_endpoint.service_address,
|
37
38
|
tags: consul_endpoint.tags.sort,
|
38
39
|
port: consul_endpoint.port
|
39
40
|
}
|
40
41
|
end
|
41
42
|
|
42
|
-
identifying = [:node, :
|
43
|
-
interesting = [*identifying, :address, :tags, :port]
|
43
|
+
identifying = [:node, :service_id]
|
44
|
+
interesting = [*identifying, :service, :service_address, :address, :tags, :port]
|
44
45
|
|
45
46
|
expected_definitions.each do |expected|
|
46
|
-
description = "#{expected.fetch(:service)} on #{expected.fetch(:node)} in Consul"
|
47
|
+
description = "#{expected.fetch(:service)} / #{expected.fetch(:service_id)} on #{expected.fetch(:node)} in Consul"
|
47
48
|
|
48
49
|
if remove_matching_service!(actual_definitions, expected, interesting)
|
49
50
|
@logger.info "Found #{description}"
|
@@ -60,7 +61,7 @@ class ConsulSyncer
|
|
60
61
|
|
61
62
|
# all definitions that are left did not match any expected definitions and are no longer needed
|
62
63
|
actual_definitions.each do |actual|
|
63
|
-
@logger.info "Removing #{actual.fetch(:service)} on #{actual.fetch(:node)} in Consul"
|
64
|
+
@logger.info "Removing #{actual.fetch(:service)} / #{actual.fetch(:service_id)} on #{actual.fetch(:node)} in Consul"
|
64
65
|
modified += 1
|
65
66
|
deregister actual.fetch(:node), actual.fetch(:service_id)
|
66
67
|
end
|
@@ -93,14 +94,16 @@ class ConsulSyncer
|
|
93
94
|
end
|
94
95
|
|
95
96
|
# creates or updates based on node and service
|
96
|
-
def register(node:, service:, address:, tags:, port:)
|
97
|
+
def register(node:, service:, service_id:, service_address:, address:, tags:, port:)
|
97
98
|
@consul.request(
|
98
99
|
:put,
|
99
100
|
'/v1/catalog/register',
|
100
101
|
Node: node,
|
101
102
|
Address: address,
|
102
103
|
Service: {
|
104
|
+
ID: service_id,
|
103
105
|
Service: service,
|
106
|
+
Address: service_address,
|
104
107
|
Tags: tags,
|
105
108
|
Port: port
|
106
109
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul_syncer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|