gaptool-client 0.6.15 → 0.6.16
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/VERSION +1 -1
- data/gaptool-client.gemspec +1 -1
- data/lib/gaptool-client.rb +39 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e01b0226f6f7427180444151fee2f3acbd387a2
|
4
|
+
data.tar.gz: 54954efa74261d238d35fdccf78e17682fafddc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0180e32470e826a282e6e615be43ad067c6f9953716d91a86d45158bc8d55c2e37d7f00e88d4a5223b262954a53e687a22b70ca7f1cd7a4379ee08ea0ecf55
|
7
|
+
data.tar.gz: dfebc691cc7c39e72ff1cbb1a9f06d320a76db99c4884c91f1af538b98301eacf42ec40fb98541a8625ee49a634e644861bd101310c16f1ab4d6923ac113d698
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.16
|
data/gaptool-client.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency 'clamp', "~> 0.6"
|
32
32
|
s.add_runtime_dependency 'net-ssh', "~> 2.9"
|
33
33
|
s.add_runtime_dependency 'net-scp', "~> 1.2"
|
34
|
-
s.add_runtime_dependency 'gaptool-api', "~> 0.6", ">= 0.6.
|
34
|
+
s.add_runtime_dependency 'gaptool-api', "~> 0.6", ">= 0.6.5"
|
35
35
|
s.add_runtime_dependency 'builder', "~> 3"
|
36
36
|
|
37
37
|
s.add_development_dependency 'shoulda', "~> 3"
|
data/lib/gaptool-client.rb
CHANGED
@@ -16,11 +16,12 @@ def infohelper(nodes, parseable, grepable)
|
|
16
16
|
unless grepable
|
17
17
|
puts Rainbow(@host).green
|
18
18
|
end
|
19
|
-
node.keys.
|
19
|
+
keys = node.keys.sort
|
20
|
+
keys.each do |key|
|
20
21
|
if grepable
|
21
22
|
puts "#{@host}|#{key}|#{node[key]}"
|
22
23
|
else
|
23
|
-
unless key ==
|
24
|
+
unless key == keys.last
|
24
25
|
puts " ┠ #{Rainbow(key).cyan}: #{node[key]}"
|
25
26
|
else
|
26
27
|
puts " ┖ #{Rainbow(key).cyan}: #{node[key]}\n\n"
|
@@ -214,22 +215,51 @@ module Gaptool
|
|
214
215
|
option ["-i", "--instance"], "INSTANCE", "Node instance, leave blank to query avilable nodes", :required => false
|
215
216
|
option ["-p", "--parseable"], :flag, "Display in non-pretty parseable JSON"
|
216
217
|
option ["-g", "--grepable"], :flag, "Display in non-pretty grep-friendly text"
|
218
|
+
option ['-H', '--hidden'], :flag, 'Display hidden hosts'
|
217
219
|
|
218
220
|
def execute
|
219
221
|
@nodes = Array.new
|
222
|
+
params = hidden? ? {hidden: true} : {}
|
220
223
|
if instance
|
221
224
|
@nodes = [$api.getonenode(instance)]
|
222
225
|
elsif role && environment
|
223
|
-
@nodes = $api.getenvroles(role, environment)
|
226
|
+
@nodes = $api.getenvroles(role, environment, params)
|
224
227
|
elsif role && !environment
|
225
|
-
@nodes = $api.getrolenodes(role)
|
228
|
+
@nodes = $api.getrolenodes(role, params)
|
226
229
|
else
|
227
|
-
@nodes = $api.getallnodes()
|
230
|
+
@nodes = $api.getallnodes(params)
|
228
231
|
end
|
229
232
|
infohelper(@nodes, parseable?, grepable?)
|
230
233
|
end
|
231
234
|
end
|
232
235
|
|
236
|
+
class SetCommand < Clamp::Command
|
237
|
+
option ["-i", "--instance"], "INSTANCE", "Node instance, required", required: true
|
238
|
+
option ["-p", "--parseable"], :flag, "Display in non-pretty parseable JSON"
|
239
|
+
option ["-g", "--grepable"], :flag, "Display in non-pretty grep-friendly text"
|
240
|
+
option ['-k', '--parameter'], 'NAME', 'Set parameter for the node', required: true, multivalued: true
|
241
|
+
option ['-v', '--value'], 'VALUE', 'Value for parameter', required: true, multivalued: true
|
242
|
+
|
243
|
+
def convert_bool(v)
|
244
|
+
case v.downcase
|
245
|
+
when "true"
|
246
|
+
true
|
247
|
+
when "false"
|
248
|
+
false
|
249
|
+
else
|
250
|
+
v
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def execute
|
255
|
+
if parameter_list.length != value_list.length
|
256
|
+
puts Rainbow("parameter and value length mismatch").red
|
257
|
+
end
|
258
|
+
params = Hash[parameter_list.each_with_index.map {|p, i| [p, convert_bool(value_list[i])]}]
|
259
|
+
infohelper([$api.setparameters(instance, params)], parseable?, grepable?)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
233
263
|
class ChefrunCommand < Clamp::Command
|
234
264
|
option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
|
235
265
|
option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
|
@@ -288,13 +318,15 @@ module Gaptool
|
|
288
318
|
option ["-r", "--rollback"], :flag, "Toggle this to rollback last deploy"
|
289
319
|
option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => false
|
290
320
|
option ["-A", "--attribute"], "ATTRIBUTE", "Pass one or more parameters to the deploy recipe in recipe.attr=value format", :multivalued => true
|
321
|
+
option ['-H', '--hidden'], :flag, 'Display hidden hosts'
|
291
322
|
|
292
323
|
def execute
|
293
324
|
attrs = split_attrs(attribute_list)
|
294
325
|
if instance
|
295
326
|
nodes = [$api.getonenode(instance)]
|
296
327
|
else
|
297
|
-
|
328
|
+
params = hidden? ? {hidden: true} : {}
|
329
|
+
nodes = $api.getappnodes(app, environment, params)
|
298
330
|
end
|
299
331
|
nodes.peach do |node|
|
300
332
|
if node['chef_runlist'].nil?
|
@@ -360,6 +392,7 @@ module Gaptool
|
|
360
392
|
subcommand "init", "Create new application cluster", InitCommand
|
361
393
|
subcommand "terminate", "Terminate instance", TerminateCommand
|
362
394
|
subcommand "ssh", "ssh to cluster host", SshCommand
|
395
|
+
subcommand "set", "update properties for a node", SetCommand
|
363
396
|
subcommand "chefrun", "chefrun on a resource pool", ChefrunCommand
|
364
397
|
subcommand "deploy", "deploy on an application", DeployCommand
|
365
398
|
subcommand "rehash", "Regenerate all host metadata. KNOW WHAT THIS DOES BEFORE RUNNING IT", RehashCommand
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaptool-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Laurita
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -105,7 +105,7 @@ dependencies:
|
|
105
105
|
version: '0.6'
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0.6.
|
108
|
+
version: 0.6.5
|
109
109
|
type: :runtime
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
version: '0.6'
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.6.
|
118
|
+
version: 0.6.5
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: builder
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|