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 +4 -4
- data/elastic_manager.gemspec +1 -1
- data/lib/elastic_manager/delete.rb +2 -1
- data/lib/elastic_manager/request.rb +6 -4
- data/lib/elastic_manager/utils.rb +15 -0
- 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: 7a23400a40a5fc5f0a623c2ebd75cdea7e601fd4245826cc818f87c5244a38b8
|
4
|
+
data.tar.gz: e8b8197d2d83f4b6c12ec26f0da7b117f0d55b91c70bff28d51d41581a6eb570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f4ae8d9c35aa363bfbfe7fdd8e3e88499f29e656ca4be3df1270150d223c70feaf3443f22db9d89a22849ce1c71e2c0985167a79d46ceaa75021d8c6b3d61b
|
7
|
+
data.tar.gz: 24c86b2882014cea8401f4135e610d9f37e4b2008c243efe697e0295b05245d8a24e7cc901ab74fa64d291ee186597fdf0d54bb4c8f25b5e4eef75dd9d9a74c5
|
data/elastic_manager.gemspec
CHANGED
@@ -37,7 +37,8 @@ module Delete
|
|
37
37
|
response = @elastic.request(:get, "/_cat/indices/#{index}")
|
38
38
|
|
39
39
|
if index_exist?(response)
|
40
|
-
|
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
|
-
|
322
|
-
|
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
|
-
|
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']
|