aggkit 0.4.6.13043 → 0.4.6.13051

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/bin/aggexec +4 -4
  4. data/bin/aggwrap +14 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1dc715b958bd63ed5d98b7f26e8c36eacba09c4122ed2389b18b340f3a878d7
4
- data.tar.gz: add638845ed60d447f2ca152c43a45c8a95c503d801c4156ed8ead0920649be2
3
+ metadata.gz: f0e8a711fd2ef8cc6b09a3968a080469320c3c144431be31dbe5a21bdef15b22
4
+ data.tar.gz: 5b351bdad4973bcb0fa306d906142e1ea9de6afe15e77ef52243ab882c6b9e7f
5
5
  SHA512:
6
- metadata.gz: 76421604f394967145c6b3ab08ff0af23d3e65758e5729a1016d8636724bd99e85821ec152b8218d6f43827fa76fce33ebf62ebc70619892687b7980626151e4
7
- data.tar.gz: bc68320dad71145bf1a9c2f4a1fe593c68a9c98b8675284c02951f611cab14b1ff59517945770b99a362ef49ccf56b92e01df3fc02116fde680d96660f24c847
6
+ metadata.gz: d2ec7983da31fa9cc1c7c8fa87351e482c466724e0e9a05329303abbefd821ea4fff85fa825a5062f9091c538f207044284dcfb8e28e3da0a3207b5ac8deb0c5
7
+ data.tar.gz: 9514795cd8b42f07dc362efcb31603cd4f1670ce303113081311ace8ddddc77da983df5fdb532673f4d5eb86a9e90cbcf42ed76e09a9ee389a35be3d55e99617
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aggkit (0.4.6.13043)
4
+ aggkit (0.4.6.13051)
5
5
  diplomat
6
6
  dotenv
7
7
  json
data/bin/aggexec CHANGED
@@ -8,10 +8,10 @@ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], ho
8
8
 
9
9
 
10
10
  @opts = {
11
- depends: [],
12
- prefixes: [],
13
- templates: [],
14
- dereference:true
11
+ depends: [],
12
+ prefixes: [],
13
+ templates: [],
14
+ dereference: true
15
15
  }
16
16
 
17
17
  @opts[:exec] = (begin
data/bin/aggwrap CHANGED
@@ -67,9 +67,14 @@ consul_addr = Aggkit::Consul.build_consul_addr(addr: ENV['CONSUL_HTTP_ADDR'], ho
67
67
  @opts = {
68
68
  service: ENV['AGGREDATOR_SERVICE'],
69
69
  id: "#{Time.now.utc.strftime('%FT%T%z')}_#{SecureRandom.hex(2)}",
70
- reload_interval: DEFAULT_RELOAD_INTERVAL
70
+ reload_interval: DEFAULT_RELOAD_INTERVAL,
71
+ tags: []
71
72
  }
72
73
 
74
+ unless ENV['AGGREDATOR_SERVICE_TAGS'].to_s.empty?
75
+ @opts[:tags] += ENV['AGGREDATOR_SERVICE_TAGS'].to_s.split(/[ ;,|]/).map(&:to_s).reject(&:empty?)
76
+ end
77
+
73
78
  @opts[:exec] = (begin
74
79
  idx = ARGV.index {|a| a.strip == '--' } + 1
75
80
  ARGV[idx..-1]
@@ -84,6 +89,10 @@ parser = Aggkit::OptionParser.new do |o|
84
89
  @opts[:service] = service.to_s
85
90
  end
86
91
 
92
+ o.on('--tags=tag1,tag2...', 'Set list of tags for service') do |list|
93
+ @opts[:tags] += list.to_s.split(/[ ;,|]/).map(&:to_s).reject(&:empty?)
94
+ end
95
+
87
96
  o.on('--id <identifier>', 'Set service identifier to concat with name. Random when default') do |id|
88
97
  @opts[:id] = id.to_s
89
98
  end
@@ -140,6 +149,7 @@ die 'service name must be provided' if @opts[:service].to_s.empty?
140
149
 
141
150
  die 'script must be provided' if @opts[:exec].empty?
142
151
 
152
+ @opts[:tags] << "service-#{@opts[:service]}"
143
153
 
144
154
  Diplomat.configure do |config|
145
155
  config.url = @opts[:consul]
@@ -150,7 +160,8 @@ SERVICE_ID = "#{@opts[:service]}_#{@opts[:id]}".freeze
150
160
  @service = {
151
161
  Name: @opts[:service],
152
162
  ID: SERVICE_ID,
153
- Checks: []
163
+ Checks: [],
164
+ Tags: @opts[:tags]
154
165
  }
155
166
 
156
167
  @checks = {}
@@ -305,6 +316,7 @@ Thread.new(@opts[:reload_interval], @opts[:service]) do |sleep_interval, service
305
316
 
306
317
  service_data = data.dig(*kv_prefix)
307
318
  next if service_data.nil?
319
+
308
320
  new_hash = Digest::MD5.new.update(service_data.to_json).hexdigest
309
321
  if !config_hash.nil? && config_hash != new_hash
310
322
  die('Change kv configuration for consul service.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6.13043
4
+ version: 0.4.6.13051
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan