opzworks 0.3.6 → 0.3.7

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: b900b683b64fe28a7b7fe4a8821e1f670a8bedcc
4
- data.tar.gz: 49542f086fba79c2992f4f0fbe017568c5457740
3
+ metadata.gz: f769a4874e232e192be19c8fb468ea8242a620d0
4
+ data.tar.gz: d14aa92875d879a41cbab51d7323b596c85a2d22
5
5
  SHA512:
6
- metadata.gz: 8505d8db7dfc0320907668050191e0aaaed915f5772aa20abe6a157ebe48bf3e311af2fdf20b675b62b2fd19d9c55e06d9eca7d9f5907c0f0a75632cf3fd16a8
7
- data.tar.gz: 7d708dc4ddd78d77ee84610ce03d61d85e3d8c5dafa1ab62811ace577cce6c3858072e0a0c890ab7a4ddb4cf5ddcab519aa42c9594b990b48cb6926914a2d633
6
+ metadata.gz: 157cc2f33e2af666ac7e7f36ceb23eedc7ac17e6caed66bc35b84f10ab5e7df27ba4b65bd6a9fbd6a99bcb562305f1252a147b266d97aaebc968e71d0f504323
7
+ data.tar.gz: 62121775ae8fb5eddc957d5e88d90189e231426dd95c62258da8f0d025616563b798f47c0525e0b0a30e3cfe9b09c57a0d09fc648056d28d44fe6efa414c1a4b
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  changelog
2
2
  =========
3
3
 
4
+ 0.3.7
5
+ -----
6
+ * elastic code enhancements, including a timeout on ssh connect
7
+
4
8
  0.3.6
5
9
  -----
6
10
  * bug fix for elasticsearch 'start'
@@ -60,12 +60,14 @@ module OpzWorks
60
60
  puts "\n________________________________________________"
61
61
  puts "Now operating on host #{ip}".foreground(:yellow)
62
62
 
63
- es_enable_allocation(ip, 'none') if @disable_shard_allocation == true
64
- sleep 2 if @disable_shard_allocation == true
63
+ if @disable_shard_allocation
64
+ es_enable_allocation(ip, 'none')
65
+ sleep 2
66
+ end
65
67
 
66
68
  es_service('restart', [ip])
67
69
  es_wait_for_status(ip, 'yellow')
68
- es_enable_allocation(ip, 'all') if @disable_shard_allocation == true
70
+ es_enable_allocation(ip, 'all') if @disable_shard_allocation
69
71
  es_wait_for_status(ip, 'green')
70
72
  end
71
73
  end
@@ -82,8 +84,10 @@ module OpzWorks
82
84
  case options[:stop]
83
85
  when true
84
86
  # use the first host to disable shard allocation
85
- es_enable_allocation(@ip_addrs.first, 'none') if @disable_shard_allocation == true
86
- sleep 2 if @disable_shard_allocation == true
87
+ if @disable_shard_allocation
88
+ es_enable_allocation(@ip_addrs.first, 'none')
89
+ sleep 2
90
+ end
87
91
 
88
92
  es_service('stop', @ip_addrs)
89
93
  end
@@ -91,13 +95,15 @@ module OpzWorks
91
95
  case options[:bounce]
92
96
  when true
93
97
  # use the first host to disable shard allocation
94
- es_enable_allocation(@ip_addrs.first, 'none') if @disable_shard_allocation == true
95
- sleep 2 if @disable_shard_allocation == true
98
+ if @disable_shard_allocation
99
+ es_enable_allocation(@ip_addrs.first, 'none')
100
+ sleep 2
101
+ end
96
102
 
97
103
  es_service('restart', @ip_addrs)
98
104
 
99
105
  es_wait_for_status(@ip_addrs.first, 'yellow')
100
- es_enable_allocation(@ip_addrs.first, 'all') if @disable_shard_allocation == true
106
+ es_enable_allocation(@ip_addrs.first, 'all') if @disable_shard_allocation
101
107
  es_wait_for_status(@ip_addrs.first, 'green')
102
108
  end
103
109
  end
@@ -45,7 +45,7 @@ def es_get_input(input, data = {}, *cmd)
45
45
  options = {}
46
46
  if layer == ''
47
47
  puts 'Must specify a layer.'.foreground(:red)
48
- abort
48
+ return false
49
49
  else
50
50
  options[:layer_id] = layer
51
51
  end
@@ -86,7 +86,9 @@ def es_service(command, ips = [])
86
86
  session.use "#{user}@#{ip}"
87
87
  end
88
88
 
89
- session.exec "sudo service elasticsearch #{command}"
89
+ Timeout::timeout(10) do
90
+ session.exec "sudo service elasticsearch #{command}"
91
+ end
90
92
  session.loop
91
93
  end
92
94
  end
@@ -1,4 +1,5 @@
1
1
  require 'inifile'
2
+ require 'rainbow'
2
3
 
3
4
  module OpzWorks
4
5
  def self.config
@@ -12,7 +13,7 @@ module OpzWorks
12
13
  def initialize
13
14
  file = ENV['AWS_CONFIG_FILE'] || "#{ENV['HOME']}/.aws/config"
14
15
 
15
- fail 'AWS config file not found' unless File.exist? file
16
+ fail 'AWS config file not found!'.foreground(:red) unless File.exist? file
16
17
  ini = IniFile.load(file)
17
18
 
18
19
  # set the region and the profile we want to pick up from ~/.aws/credentials
data/lib/opzworks/meta.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module OpzWorks
2
- VERSION = '0.3.6'
2
+ VERSION = '0.3.7'
3
3
  AUTHORS = ['Grant Heffernan', 'Mapzen']
4
4
  EMAIL = ['grant@mapzen.com']
5
5
  DESCRIPTION = 'OpzWorks Utilities'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opzworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Heffernan