Skip to content

Commit 4e79d27

Browse files
committed
send stop start requests
1 parent d5508af commit 4e79d27

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

app/config/mrt/query/query.sql.misc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ queries:
44
select
55
now() as current
66
/queries/misc/bad-query:
7+
test_skip: true
78
sql: |
89
select
910
from foo

app/lib/routes/services.rb

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,31 @@ def self.registered(app)
146146

147147
app.post '/json/inventory/start' do
148148
resp = java_service_send_stop_start('inventory', START_ENDPOINT)
149+
if resp.empty?
150+
inventory_hosts.each do |host|
151+
begin
152+
resp << post_url("#{host}/#{START_ENDPOINT}")
153+
rescue StandardError => e
154+
logger.error("Error sending start to inventory host #{host}: #{e}")
155+
end
156+
end
157+
end
149158
return post_url("#{inventory_host}/#{START_ENDPOINT}") if resp.empty?
150159

151160
resp.to_json
152161
end
153162

154163
app.post '/json/inventory/stop' do
155164
resp = java_service_send_stop_start('inventory', STOP_ENDPOINT)
165+
if resp.empty?
166+
inventory_hosts.each do |host|
167+
begin
168+
resp << post_url("#{host}/#{STOP_ENDPOINT}")
169+
rescue StandardError => e
170+
logger.error("Error sending stop to inventory host #{host}: #{e}")
171+
end
172+
end
173+
end
156174
return post_url("#{inventory_host}/#{STOP_ENDPOINT}") if resp.empty?
157175

158176
resp.to_json
@@ -180,13 +198,31 @@ def self.registered(app)
180198

181199
app.post '/json/audit/start' do
182200
resp = java_service_send_stop_start('audit', START_ENDPOINT)
201+
if resp.empty?
202+
audit_hosts.each do |host|
203+
begin
204+
resp << post_url("#{host}/#{START_ENDPOINT}")
205+
rescue StandardError => e
206+
logger.error("Error sending start to audit host #{host}: #{e}")
207+
end
208+
end
209+
end
183210
return post_url("#{audit_host}/#{START_ENDPOINT}") if resp.empty?
184211

185212
resp.to_json
186213
end
187214

188215
app.post '/json/audit/stop' do
189216
resp = java_service_send_stop_start('audit', STOP_ENDPOINT)
217+
if resp.empty?
218+
audit_hosts.each do |host|
219+
begin
220+
resp << post_url("#{host}/#{STOP_ENDPOINT}")
221+
rescue StandardError => e
222+
logger.error("Error sending stop to audit host #{host}: #{e}")
223+
end
224+
end
225+
end
190226
return post_url("#{audit_host}/#{STOP_ENDPOINT}") if resp.empty?
191227

192228
resp.to_json
@@ -203,13 +239,31 @@ def self.registered(app)
203239

204240
app.post '/json/replic/start' do
205241
resp = java_service_send_stop_start('replic', START_ENDPOINT)
242+
if resp.empty?
243+
replic_hosts.each do |host|
244+
begin
245+
resp << post_url("#{host}/#{START_ENDPOINT}")
246+
rescue StandardError => e
247+
logger.error("Error sending start to replic host #{host}: #{e}")
248+
end
249+
end
250+
end
206251
return post_url("#{replic_host}/#{START_ENDPOINT}") if resp.empty?
207252

208253
resp.to_json
209254
end
210255

211256
app.post '/json/replic/pause' do
212257
resp = java_service_send_stop_start('replic', 'service/pause?t=json')
258+
if resp.empty?
259+
replic_hosts.each do |host|
260+
begin
261+
resp << post_url("#{host}/service/pause?t=json")
262+
rescue StandardError => e
263+
logger.error("Error sending pause to replic host #{host}: #{e}")
264+
end
265+
end
266+
end
213267
return post_url("#{replic_host}/service/pause?t=json") if resp.empty?
214268

215269
resp.to_json

0 commit comments

Comments
 (0)