elasticsearch-manager 0.1.0 → 0.1.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzUxYjRmNjI1YTNiMWM4ODMwODZjZTE4NTllNmIzYWQ2NmUxOGFkNA==
4
+ N2FlYzM2ZDk2Njg4M2I5NTJkOGQ4M2ZjMGM3ZjA2MjFiMjk3MmY3ZQ==
5
5
  data.tar.gz: !binary |-
6
- OTc0NjdmM2YxNDkwZTcwMDM0ZDUwNzI0YWFlZjlhYTg0ODZkYjZkNg==
6
+ OGVjMGNiNjUxZjhjZGNmNThmYWZlZDZiOWVkMzYyY2M1MzI3YWZiOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Zjc4M2Y4NTY4YmQ0NzczYTNmZjAwM2VlZjEwN2Q2OGI5NDBjOWQ1OWQwOWE0
10
- YjJiMzRmODc2NTYzNzNkZjBiMmNkNTVhM2YxY2RhMmYxZWVmNDAxYTkzOTE4
11
- NGIxMTk3Zjc4ZmJmZTU2YWQ4ZmM0MTI2NjU4ZDNkODBiNTE1MDg=
9
+ Yzk1YTMwYjBmYmRkZTVmYjU0ZmYwNjg1NzhhMTRiNDk3NjczMDdjMjVkNDNm
10
+ Mjk2NGYyOTM5YmNjOGZjMmNhNTkwNmQ0M2NlMzBhMjRjMzk0MGUxODUwZmVj
11
+ NDViNjU2N2ZjNDZlNGRlNzFmYTgzODNhYWUzNjY1MDE4MTg2MWI=
12
12
  data.tar.gz: !binary |-
13
- ZDFkM2NiOTFmMjVhYzEyMWI3NDA1YzlmYzRjMmVmMDZjMDU4YzI3MzcwNDgy
14
- YTZkMWIxNmQwNDAxYTQzZDRmY2Y5NzMzNDMxMGI5NzIzOTU4MmM5YjliMzkz
15
- ZWE2NmY1NDUxYThjZTdkNDU2YmU2ZmQ2MDNlOTVhNmZiMThmNzQ=
13
+ Y2Y1YTg4Mjg0NjhjN2ZhZjZiYzZiMmU2Zjk3MjhiNmNhM2VkZWIwOWE3NmUw
14
+ ODhiNDA0ZjI2NWEyZDhkNGFmZTAzODJiYTY0YzZjZWE2NzJlNjE3MGVkZjVj
15
+ Mjg0ZmRhODI5ZmU1NjU4N2NhMzFjZmVlNDk3MjNjYzA2YzYwNTA=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elasticsearch-manager (0.1.0)
4
+ elasticsearch-manager (0.1.1)
5
5
  colorize (~> 0.7)
6
6
  highline (~> 1.7)
7
7
  json (~> 1.8)
@@ -38,6 +38,11 @@ EOC
38
38
  opts.on('-t TIMEOUT', '--timeout TIMEOUT', 'Timeout for waiting for cluster to stabilize during rolling-restart [default: 600]') do |p|
39
39
  options[:port] = p
40
40
  end
41
+
42
+ options[:verbose] = false
43
+ opts.on('-v', '--verbose', 'Print verbose messaging') do |v|
44
+ options[:verbose] = v
45
+ end
41
46
  end
42
47
 
43
48
  opt_parser.parse!
@@ -14,7 +14,7 @@ module Elasticsearch
14
14
  manager = _manager(opts)
15
15
  # Check that the cluster is stable?
16
16
  unless manager.cluster_stable?
17
- print_cluster_stable(manager)
17
+ print_cluster_status(manager, 'The cluster is currently unstable! Not proceeding with rolling-restart')
18
18
  return 2
19
19
  end
20
20
  puts "Discovering cluster members...\n"
@@ -35,6 +35,7 @@ module Elasticsearch
35
35
  manager = _manager(opts)
36
36
  status = manager.cluster_status
37
37
  puts "The Elasticsearch cluster is currently: #{status.colorize(status.to_sym)}"
38
+ print_cluster_status(manager) if opts[:verbose]
38
39
  return 0
39
40
  end
40
41
 
@@ -43,19 +44,19 @@ module Elasticsearch
43
44
  ESManager.new(opts[:hostname], opts[:port])
44
45
  end
45
46
 
46
- def self.print_cluster_stable(manager)
47
+ def self.print_cluster_status(manager, msg = nil)
47
48
  health = manager.cluster_health
48
- puts 'The cluster is currently unstable! Not proceeding with rolling-restart'
49
+ puts msg unless msg.nil?
49
50
  puts "\tCluster status: #{health.status.colorize(health.status.to_sym)}"
50
51
 
51
52
  relocating = health.relocating_shards == 0 ? :green : :red
52
53
  puts "\tRelocating shards: #{health.relocating_shards.to_s.colorize(relocating)}"
53
54
 
54
55
  initializing = health.initializing_shards == 0 ? :green : :red
55
- puts "\tInitializing shards: #{health.relocating_shards.to_s.colorize(relocating)}"
56
+ puts "\tInitializing shards: #{health.initializing_shards.to_s.colorize(initializing)}"
56
57
 
57
58
  unassigned = health.unassigned_shards == 0 ? :green : :red
58
- puts "\tUnassigned shards: #{health.relocating_shards.to_s.colorize(relocating)}"
59
+ puts "\tUnassigned shards: #{health.unassigned_shards.to_s.colorize(unassigned)}"
59
60
  end
60
61
  end
61
62
  end
@@ -14,11 +14,11 @@ module Elasticsearch
14
14
  def rolling_restart(timeout = 600, sleep_interval = 30)
15
15
  highline = HighLine.new
16
16
  @members.each do |m|
17
- restart_node(m, timeout, sleep_interval) unless m == @leader
18
- if m != @members[-1]
17
+ unless m == @leader
19
18
  unless highline.agree('Continue with rolling restart of cluster? (y/n) ')
20
19
  raise UserRequestedStop, "Stopping rolling restart at user request!".colorize(:red)
21
20
  end
21
+ restart_node(m, timeout, sleep_interval)
22
22
  end
23
23
  end
24
24
  unless highline.agree("\nRestarting current cluster master, continue? (y/n) ")
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Manager
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Oldfield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-07 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler