elastic_manager 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 147eb5fe56636f86a13ee87f2c2ff672281649c72fc8f4b77bcdee3bcfa8477f
4
- data.tar.gz: 17f93ead08eae9bc085140e0aa2f005790d22732fdf7f5f4bccf7522219cec6b
3
+ metadata.gz: fb139beb6d9318303760c37ccc6c1e84b06e25f66933858c8f9eaeb40e05f4b9
4
+ data.tar.gz: 985de58d74f0be96016a3acdacc05823d780250cd445506338dbb12962414bc6
5
5
  SHA512:
6
- metadata.gz: 444b1167db79fb598a7ad8a0262ec70eac8f91ca615bd5ab9c749784baeb5cfc107a8e5343e9af4434a2ebd26acb492136a70622e430a07e22ade71228f00eaf
7
- data.tar.gz: 5851be25cea30b8a47ca2b70ba78d97fa82dff876802b08ff819ecd7db27211f6cfd9c8c0710dda1223e5a3021684509dbe43252f04e6d9152e96b2913329d06
6
+ metadata.gz: e9cf6bb907c0417266ef9a1403a0f95392adad759a84677076352046d4960467ed9ac9de2894c073cb29c8747afef959cf59b6dd7a4ea48c139948e3e0436a8d
7
+ data.tar.gz: 62abeb754c6c9031384b6289a147a43e115f2138aecde7bc44318e43a6314ba698258b0b918d81618593a2a49a21a302bcc0131d8040a88af21f4ca43fa19360
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_manager'
5
5
  s.executables = ['elastic_manager']
6
- s.version = '0.2.8'
6
+ s.version = '0.2.9'
7
7
  s.date = '2018-10-15'
8
8
  s.summary = 'Because qurator sucks'
9
9
  s.description = 'Manager for logstash indices in elastic'
@@ -200,12 +200,12 @@ module Request
200
200
  if snapshot['state'] == 'SUCCESS'
201
201
  snapshot['snapshot']
202
202
  else
203
- log.fatal 'wrong snapshot state'
204
- exit 1
203
+ log.error 'wrong snapshot state'
204
+ return false
205
205
  end
206
206
  else
207
- log.fatal "can't find snapshot #{snapshot_name} in #{repo} response was: #{response.code} - #{response}"
208
- exit 1
207
+ log.error "can't find snapshot #{snapshot_name} in #{repo} response was: #{response.code} - #{response}"
208
+ false
209
209
  end
210
210
  end
211
211
 
@@ -214,6 +214,8 @@ module Request
214
214
  snapshot_repo = find_snapshot_repo
215
215
  snapshot = find_snapshot(snapshot_repo, snapshot_name)
216
216
 
217
+ return false unless snapshot
218
+
217
219
  body = {
218
220
  index_settings: {
219
221
  'index.number_of_replicas' => 0,
@@ -227,8 +229,8 @@ module Request
227
229
  sleep 5
228
230
  wait_snapshot_restore(index)
229
231
  else
230
- log.fatal "can't restore snapshot #{snapshot_name} response was: #{response.code} - #{response}"
231
- exit 1
232
+ log.error "can't restore snapshot #{snapshot_name} response was: #{response.code} - #{response}"
233
+ false
232
234
  end
233
235
  end
234
236
 
@@ -241,7 +243,7 @@ module Request
241
243
 
242
244
  if response.code == 200
243
245
  # TODO: (anton.ryabov) add logging of percent and time ?
244
- restore_ok = json_parse(response)[index]['shards'].map { |s| s['stage'] == 'DONE' }.all?{ |a| a == true }
246
+ restore_ok = json_parse(response)[index]['shards'].map { |s| s['stage'] == 'DONE' }.all? { |a| a }
245
247
  else
246
248
  log.error "can't check recovery: #{response.code} - #{response}"
247
249
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antony Ryabov