elasticsearch_s3_backup 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 081728682c1244d2281ea3eb51fcd4bbf77e3c38
4
- data.tar.gz: b25a45c8f558abc41a53d77cb50f62c2192ada16
3
+ metadata.gz: b4858fa0862e04b674d69efb32506e2f1736866a
4
+ data.tar.gz: 569033bcb7439fadea70e55fd17e40bdae1bcd88
5
5
  SHA512:
6
- metadata.gz: ae09000b630cc92a3762906230c1bf5d0e2a1bd9c05219d36975f24b26656f6be0b472f022b97de8ff91bf8eae94dc0cd530c3b7bf2735fae38fef62e35b295f
7
- data.tar.gz: 22bccb3af01e88c01f6641a99a59ffa23b3e16d812935f0d0ee9e20491ec70dd283f00f535bcd1fbf5d95dd3e132b71f22c1fecf184915f194b9ac3ae11d14c1
6
+ metadata.gz: 360fd85e6fcd21746a49504c8b5d4c61c1e7605d135e64643cdfac3f52a424ecb446e329ce442fa8974e581d562eb06950a835741d6db3ab9de6aebdb46bdc7d
7
+ data.tar.gz: 85a5d1d8738dde41f5b3763ec13393491190e85dc1779a55d69111434fc68fe2bb0ffa3d5f64e254b645f5244a1d4ec9548225708e00c30465fde8f4ebad8a4d
@@ -6,6 +6,7 @@ require 'pagerduty'
6
6
  require 'yaml'
7
7
  require 'sentry-raven'
8
8
  require 'ostruct'
9
+ require 'hashie'
9
10
  require 'elasticsearch'
10
11
 
11
12
  module EverTools
@@ -30,6 +31,8 @@ module EverTools
30
31
  exit
31
32
  end
32
33
 
34
+ check_cluster_state!
35
+
33
36
  cleanup_test_indexes
34
37
  insert_test_data
35
38
 
@@ -117,6 +120,14 @@ module EverTools
117
120
  es_api.nodes.info['nodes'][es_api.cluster.state['master_node']]['name'] == node_name
118
121
  end
119
122
 
123
+ def check_cluster_state!
124
+ cluster_settings = Hashie::Mash.new es_api.cluster.get_settings
125
+ if cluster_settings.transient_.cluster_.routing_.allocation_.enable == 'none'
126
+ fail 'Shard reallocation is disabled. Snapshot cannot proceed because creating the test ' \
127
+ 'index in this state will put the cluster into RED state.'
128
+ end
129
+ end
130
+
120
131
  def pseudo_random_string
121
132
  'a' + rand(10**100).to_s
122
133
  end
@@ -207,6 +218,7 @@ module EverTools
207
218
 
208
219
  def delete_test_indexes
209
220
  [@restore_test_index, @backup_test_index].each do |test_index|
221
+ logger.info "Removing test index: #{test_index}"
210
222
  es_api.indices.delete index: test_index
211
223
  end
212
224
  end
@@ -215,8 +227,10 @@ module EverTools
215
227
  logger.info 'Removing remnant test indexes...'
216
228
  # Gather backup test indices
217
229
  es_api.indices.get(index: 'backup_test_*').each do |test_index, _value|
218
- # Check again that they are backup test indices
219
- es_api.indices.delete index: test_index if test_index =~ /backup_test_(.*)/
230
+ if test_index =~ /backup_test_(.*)/ # Check again that they are backup test indices
231
+ logger.info "Removing test index: #{test_index}"
232
+ es_api.indices.delete index: test_index
233
+ end
220
234
  end
221
235
  end
222
236
  end
@@ -1,5 +1,5 @@
1
1
  module EverTools
2
2
  class ElasticsearchS3Backup
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch_s3_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Herot
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-23 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler