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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/aggexec +4 -4
- data/bin/aggwrap +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0e8a711fd2ef8cc6b09a3968a080469320c3c144431be31dbe5a21bdef15b22
|
4
|
+
data.tar.gz: 5b351bdad4973bcb0fa306d906142e1ea9de6afe15e77ef52243ab882c6b9e7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2ec7983da31fa9cc1c7c8fa87351e482c466724e0e9a05329303abbefd821ea4fff85fa825a5062f9091c538f207044284dcfb8e28e3da0a3207b5ac8deb0c5
|
7
|
+
data.tar.gz: 9514795cd8b42f07dc362efcb31603cd4f1670ce303113081311ace8ddddc77da983df5fdb532673f4d5eb86a9e90cbcf42ed76e09a9ee389a35be3d55e99617
|
data/Gemfile.lock
CHANGED
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.')
|