opzworks 0.5.5 → 0.5.6

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: 3a3ec197d9a15caa3c422eca7fa09e28b357b326
4
- data.tar.gz: e29fb5ca495ed84fb80c8ae8392727fcddf09e1d
3
+ metadata.gz: fcc6aedbf6f2c6cc20539634ae0057f1ff2690cb
4
+ data.tar.gz: 41f2582aaec7ff11c516381b5ca4c5e0e2f50cd9
5
5
  SHA512:
6
- metadata.gz: 196ebdad3c774d22e1f17b05735ad0556c5c7da3089226a19725cd69813d7c351e1ec5da96550867de6f321de256cac1b4f4830d90b271280b2069dbcc2ff5b5
7
- data.tar.gz: c4ee31fe4df370b05c1e571eb99a069ef72b2a9a3b0639b3c9f69f82f5addf6eab1ca888870b5b94fa181394550b04c04a978515cc1941992af4ae994878f813
6
+ metadata.gz: 943ab5e50de741e708acbbb9e98f4bdd3b9d0e1c89e10e6e1e58b7098db58985f1b64d74db2d09d1502118844bb99dc76b7c13cc4ff866efd7ea18be869bb718
7
+ data.tar.gz: 4c8679d575bf180558aa8ece5077e1846a1a3b25c614946e6e8b1168bb28cb2c075e847311f3a1e539e520e2602b7dab39770fdc179fa9745b471541a1512120
@@ -31,6 +31,7 @@ module OpzWorks
31
31
  opt :stop, 'Stop Elastic', default: false
32
32
  opt :bounce, 'Bounce (stop/start) Elastic', default: false
33
33
  opt :rolling, 'Perform a rolling restart of Elastic', default: false
34
+ opt :old_service_name, "Use 'elasticsearch' as the service name, otherwise use the layer shortname", default: false
34
35
  end
35
36
  ARGV.empty? ? Trollop.die('no stacks specified') : false
36
37
 
@@ -53,6 +54,10 @@ module OpzWorks
53
54
  end
54
55
  next if var == false
55
56
 
57
+ if options[:old_service_name]
58
+ @service_name = 'elasticsearch'
59
+ end
60
+
56
61
  case options[:rolling]
57
62
  when true
58
63
  # cycle through all the hosts, waiting for status
@@ -65,7 +70,7 @@ module OpzWorks
65
70
  sleep 2
66
71
  end
67
72
 
68
- es_service('restart', [ip])
73
+ es_service('restart', [ip], @service_name)
69
74
  es_wait_for_status(ip, 'yellow')
70
75
  es_enable_allocation(ip, 'all') if @disable_shard_allocation
71
76
  es_wait_for_status(ip, 'green')
@@ -74,7 +79,7 @@ module OpzWorks
74
79
 
75
80
  case options[:start]
76
81
  when true
77
- es_service('start', @ip_addrs)
82
+ es_service('start', @ip_addrs, @service_name)
78
83
 
79
84
  @ip_addrs.each do |ip|
80
85
  es_wait_for_status(ip, 'green')
@@ -89,7 +94,7 @@ module OpzWorks
89
94
  sleep 2
90
95
  end
91
96
 
92
- es_service('stop', @ip_addrs)
97
+ es_service('stop', @ip_addrs, @service_name)
93
98
  end
94
99
 
95
100
  case options[:bounce]
@@ -100,7 +105,7 @@ module OpzWorks
100
105
  sleep 2
101
106
  end
102
107
 
103
- es_service('restart', @ip_addrs)
108
+ es_service('restart', @ip_addrs, @service_name)
104
109
 
105
110
  es_wait_for_status(@ip_addrs.first, 'yellow')
106
111
  es_enable_allocation(@ip_addrs.first, 'all') if @disable_shard_allocation
@@ -48,6 +48,8 @@ def es_get_input(input, data = {}, *cmd)
48
48
  return false
49
49
  else
50
50
  options[:layer_id] = layer
51
+ get_shortname = @client.describe_layers(layer_ids: [layer])
52
+ get_shortname[:layers].each { |layer| @service_name = layer[:shortname] }
51
53
  end
52
54
  opsworks_list_ips(options)
53
55
  end
@@ -77,7 +79,7 @@ def es_enable_allocation(ip, type)
77
79
  end
78
80
  end
79
81
 
80
- def es_service(command, ips = [])
82
+ def es_service(command, ips = [], service_name = 'elasticsearch')
81
83
  puts "Operating on ES with command #{command}".foreground(:yellow)
82
84
  user = ENV['USER']
83
85
 
@@ -87,7 +89,7 @@ def es_service(command, ips = [])
87
89
  end
88
90
 
89
91
  Timeout.timeout(10) do
90
- session.exec "sudo service elasticsearch #{command}"
92
+ session.exec "sudo service #{service_name} #{command}"
91
93
  end
92
94
  session.loop
93
95
  end
data/lib/opzworks/meta.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module OpzWorks
2
- VERSION = '0.5.5'
2
+ VERSION = '0.5.6'
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.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Heffernan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-20 00:00:00.000000000 Z
12
+ date: 2016-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk