consul_syncer 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17887a8798f297f2b6e1483008a2aa02a8f28bdcc4d3ef4d13a4c1ad048a7cae
4
- data.tar.gz: e28b77916e2a42c6f51de972c6fe33fa10efd800d35a7263dd750e450b65fb81
3
+ metadata.gz: 59b87094f77b404c59b018035020eab02be5075c3b3d9dc3e68f28a64d8f70c0
4
+ data.tar.gz: c61781655c3a8a67e266da1e97578b9e996d7c4b43248c777ef43e35608ba8ff
5
5
  SHA512:
6
- metadata.gz: 0bed1f83c10efedfb49d41e1e70b1b4d41090bdce42e44c74810cded16311c48284e0c4c5991665f3938b4e68ed9b05033dcbe7ebcb6e4425fd3de5ac27903f8
7
- data.tar.gz: a8bc5c5c38c77b03390af3724e4182df368793f0e832bea6af73a0bdb041c0b24fe4e9239bf34a573c1e21ca6c1e64a484f0ca007acb42f629c0ab70f5b4b95b
6
+ metadata.gz: 4f164174999daa718fe237edbff4a0b1ca3389ab56db5af2ce57cfd7876c20b0d5563de016b649677e0bd14b3d7e7c544c8857a27bb271eae1291fe6a43f02da
7
+ data.tar.gz: bfd88ffae1281a70b942fb6f766fbabcc20f4ec49aca1df311a5cf79e4f6c08dc4dbd13f77110b8f38be4260e3e7a4daba8431d5996279739f475d1d0a71de6f
data/lib/consul_syncer.rb CHANGED
@@ -17,7 +17,7 @@ class ConsulSyncer
17
17
 
18
18
  # changing tags means all previous services need to be removed manually since
19
19
  # they can no longer be found
20
- def sync(expected_definitions, tags)
20
+ def sync(expected_definitions, tags, dry: false)
21
21
  raise ArgumentError, "Need at least 1 tag to reliably update endpoints" if tags.empty?
22
22
 
23
23
  modified = 0
@@ -61,11 +61,11 @@ class ConsulSyncer
61
61
  elsif remove_matching_service!(actual_definitions, expected, identifying)
62
62
  @logger.info "Updating #{description}"
63
63
  modified += 1
64
- register **expected
64
+ register **expected unless dry
65
65
  else
66
66
  @logger.info "Adding #{description}"
67
67
  modified += 1
68
- register **expected
68
+ register **expected unless dry
69
69
  end
70
70
  end
71
71
 
@@ -73,7 +73,7 @@ class ConsulSyncer
73
73
  actual_definitions.each do |actual|
74
74
  @logger.info "Removing #{actual.fetch(:service)} / #{actual.fetch(:service_id)} on #{actual.fetch(:node)} in Consul"
75
75
  modified += 1
76
- deregister actual.fetch(:node), actual.fetch(:service_id)
76
+ deregister actual.fetch(:node), actual.fetch(:service_id) unless dry
77
77
  end
78
78
 
79
79
  modified
@@ -1,3 +1,3 @@
1
1
  class ConsulSyncer
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
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: 1.0.2
4
+ version: 1.1.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: 2021-02-26 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.1.3
57
+ rubygems_version: 3.2.16
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: Sync remote services into consul