elastic_manager 0.2.9 → 0.3.0

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: fb139beb6d9318303760c37ccc6c1e84b06e25f66933858c8f9eaeb40e05f4b9
4
- data.tar.gz: 985de58d74f0be96016a3acdacc05823d780250cd445506338dbb12962414bc6
3
+ metadata.gz: 7a23400a40a5fc5f0a623c2ebd75cdea7e601fd4245826cc818f87c5244a38b8
4
+ data.tar.gz: e8b8197d2d83f4b6c12ec26f0da7b117f0d55b91c70bff28d51d41581a6eb570
5
5
  SHA512:
6
- metadata.gz: e9cf6bb907c0417266ef9a1403a0f95392adad759a84677076352046d4960467ed9ac9de2894c073cb29c8747afef959cf59b6dd7a4ea48c139948e3e0436a8d
7
- data.tar.gz: 62abeb754c6c9031384b6289a147a43e115f2138aecde7bc44318e43a6314ba698258b0b918d81618593a2a49a21a302bcc0131d8040a88af21f4ca43fa19360
6
+ metadata.gz: b7f4ae8d9c35aa363bfbfe7fdd8e3e88499f29e656ca4be3df1270150d223c70feaf3443f22db9d89a22849ce1c71e2c0985167a79d46ceaa75021d8c6b3d61b
7
+ data.tar.gz: 24c86b2882014cea8401f4135e610d9f37e4b2008c243efe697e0295b05245d8a24e7cc901ab74fa64d291ee186597fdf0d54bb4c8f25b5e4eef75dd9d9a74c5
@@ -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.9'
6
+ s.version = '0.3.0'
7
7
  s.date = '2018-10-15'
8
8
  s.summary = 'Because qurator sucks'
9
9
  s.description = 'Manager for logstash indices in elastic'
@@ -37,7 +37,8 @@ module Delete
37
37
  response = @elastic.request(:get, "/_cat/indices/#{index}")
38
38
 
39
39
  if index_exist?(response)
40
- elastic_action_with_log('delete_index', index)
40
+
41
+ elastic_action_with_log('delete_index', index, delete_without_snapshot?(index))
41
42
  else
42
43
  log.warn "#{index} index not found"
43
44
  end
@@ -317,11 +317,13 @@ module Request
317
317
  response['acknowledged'].is_a?(TrueClass)
318
318
  end
319
319
 
320
- def delete_index(index)
321
- snapshot_name = "snapshot_#{index}"
322
- snapshot_repo = find_snapshot_repo
320
+ def delete_index(index, delete_without_snapshot=false)
321
+ unless delete_without_snapshot
322
+ snapshot_name = "snapshot_#{index}"
323
+ snapshot_repo = find_snapshot_repo
323
324
 
324
- return false unless find_snapshot(snapshot_repo, snapshot_name)
325
+ return false unless find_snapshot(snapshot_repo, snapshot_name)
326
+ end
325
327
 
326
328
  response = request(:delete, "/#{index}")
327
329
 
@@ -43,6 +43,21 @@ module Utils
43
43
  false
44
44
  end
45
45
 
46
+ def delete_without_snapshot?(index)
47
+ index_name = make_index_name(index)
48
+
49
+ if @config['settings']['indices'][index_name] &&
50
+ @config['settings']['indices'][index_name]['delete_without_snapshot']
51
+
52
+ if true?(@config['settings']['indices'][index_name]['delete_without_snapshot'])
53
+ log.warn "#{index_name} index can be deleted without snapshot"
54
+ return true
55
+ end
56
+ end
57
+
58
+ false
59
+ end
60
+
46
61
  def prepare_vars
47
62
  indices = @config['indices'].split(',').map(&:strip)
48
63
  daysago = @config['daysago']
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.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antony Ryabov