gaptool-client 0.3.0 → 0.3.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.
data/Gemfile CHANGED
@@ -17,4 +17,4 @@ gem 'json'
17
17
  gem 'peach'
18
18
  gem 'rainbow'
19
19
  gem 'clamp'
20
- gem 'gaptool-api'
20
+ gem 'gaptool-api', ">= 0.3.2"
data/Gemfile.lock CHANGED
@@ -7,12 +7,12 @@ GEM
7
7
  bourne (1.1.2)
8
8
  mocha (= 0.10.5)
9
9
  clamp (0.5.0)
10
- gaptool-api (0.2.4)
10
+ gaptool-api (0.3.2)
11
11
  httparty
12
12
  git (1.2.5)
13
- httparty (0.10.0)
13
+ httparty (0.10.2)
14
14
  multi_json (~> 1.0)
15
- multi_xml
15
+ multi_xml (>= 0.5.2)
16
16
  i18n (0.6.1)
17
17
  jeweler (1.8.4)
18
18
  bundler (~> 1.0)
@@ -48,7 +48,7 @@ PLATFORMS
48
48
  DEPENDENCIES
49
49
  bundler
50
50
  clamp
51
- gaptool-api
51
+ gaptool-api (>= 0.3.2)
52
52
  jeweler (~> 1.8.4)
53
53
  json
54
54
  peach
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gaptool-client"
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Bailey"]
12
- s.date = "2013-01-17"
12
+ s.date = "2013-02-06"
13
13
  s.description = "client for gaptool-server"
14
14
  s.email = "m@mdb.io"
15
15
  s.executables = ["gt"]
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
45
45
  s.add_runtime_dependency(%q<peach>, [">= 0"])
46
46
  s.add_runtime_dependency(%q<rainbow>, [">= 0"])
47
47
  s.add_runtime_dependency(%q<clamp>, [">= 0"])
48
- s.add_runtime_dependency(%q<gaptool-api>, [">= 0"])
48
+ s.add_runtime_dependency(%q<gaptool-api>, [">= 0.3.2"])
49
49
  s.add_development_dependency(%q<shoulda>, [">= 0"])
50
50
  s.add_development_dependency(%q<rdoc>, [">= 0"])
51
51
  s.add_development_dependency(%q<bundler>, [">= 0"])
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
56
56
  s.add_dependency(%q<peach>, [">= 0"])
57
57
  s.add_dependency(%q<rainbow>, [">= 0"])
58
58
  s.add_dependency(%q<clamp>, [">= 0"])
59
- s.add_dependency(%q<gaptool-api>, [">= 0"])
59
+ s.add_dependency(%q<gaptool-api>, [">= 0.3.2"])
60
60
  s.add_dependency(%q<shoulda>, [">= 0"])
61
61
  s.add_dependency(%q<rdoc>, [">= 0"])
62
62
  s.add_dependency(%q<bundler>, [">= 0"])
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
68
68
  s.add_dependency(%q<peach>, [">= 0"])
69
69
  s.add_dependency(%q<rainbow>, [">= 0"])
70
70
  s.add_dependency(%q<clamp>, [">= 0"])
71
- s.add_dependency(%q<gaptool-api>, [">= 0"])
71
+ s.add_dependency(%q<gaptool-api>, [">= 0.3.2"])
72
72
  s.add_dependency(%q<shoulda>, [">= 0"])
73
73
  s.add_dependency(%q<rdoc>, [">= 0"])
74
74
  s.add_dependency(%q<bundler>, [">= 0"])
@@ -7,49 +7,33 @@ require 'clamp'
7
7
  require 'net/ssh'
8
8
  require 'net/scp'
9
9
 
10
- class InitCommand < Clamp::Command
11
- option ["-r", "--role"], "ROLE", "Resource name to initilize", :required => true
12
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
13
- option ["-z", "--zone"], "ZONE", "AWS availability zone to put node in", :required => true
14
- option ["-t", "--type"], "TYPE", "Type of instance, e.g. m1.large", :required => true
15
- option ["-m", "--mirror"], "GIGABYTES", "Gigs for raid mirror, must be set up on each node", :required => false
16
- def execute
17
- $api.addnode(zone, type, role, environment, mirror)
10
+ module Gaptool
11
+ class InitCommand < Clamp::Command
12
+ option ["-r", "--role"], "ROLE", "Resource name to initilize", :required => true
13
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
14
+ option ["-z", "--zone"], "ZONE", "AWS availability zone to put node in", :required => true
15
+ option ["-t", "--type"], "TYPE", "Type of instance, e.g. m1.large", :required => true
16
+ option ["-m", "--mirror"], "GIGABYTES", "Gigs for raid mirror, must be set up on each node", :required => false
17
+ def execute
18
+ $api.addnode(zone, type, role, environment, mirror)
19
+ end
18
20
  end
19
- end
20
21
 
21
- class TerminateCommand < Clamp::Command
22
- option ["-z", "--zone"], "ZONE", "AWS availability zone to put node in", :required => true
23
- option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => true
24
- def execute
25
- $api.terminatenode(instance, zone)
22
+ class TerminateCommand < Clamp::Command
23
+ option ["-z", "--zone"], "ZONE", "AWS availability zone to put node in", :required => true
24
+ option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => true
25
+ def execute
26
+ $api.terminatenode(instance, zone)
27
+ end
26
28
  end
27
- end
28
29
 
29
- class SshCommand < Clamp::Command
30
- option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
31
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
32
- option ["-i", "--instance"], "INSTANCE", "Node instance, leave blank to query avilable nodes", :require => false
33
- option ["-f", "--first"], :flag, "Just connect to first available instance"
34
- option ["-t", "--tmux"], :flag, "Open cluster in windows in a tmux session"
30
+ class SshCommand < Clamp::Command
31
+ option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
32
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
33
+ option ["-i", "--instance"], "INSTANCE", "Node instance, leave blank to query avilable nodes", :require => false
34
+ option ["-f", "--first"], :flag, "Just connect to first available instance"
35
35
 
36
- def execute
37
- if tmux?
38
- nodes = $api.getenvroles(role, environment)
39
- system "tmux start-server"
40
- nodes.each_index do |i|
41
- @ssh = $api.ssh(role, environment, nodes[i]['instance'])
42
- if i == 0
43
- system "tmux new-session -d -s #{role}-#{environment} -n #{nodes[i]['instance']}"
44
- else
45
- system "tmux new-window -t #{role}-#{environment}:#{i} -n #{nodes[i]['instance']}"
46
- end
47
- File.open("/tmp/gtkey-#{nodes[i]['instance']}", 'w') {|f| f.write(@ssh['key'])}
48
- File.chmod(0600, "/tmp/gtkey-#{nodes[i]['instance']}")
49
- system "tmux send-keys -t #{role}-#{environment}:#{i} 'SSH_AUTH_SOCK=\"\" ssh -i /tmp/gtkey-#{nodes[i]['instance']} admin@#{@ssh['hostname']}' C-m"
50
- end
51
- system "tmux attach -t #{role}-#{environment}"
52
- else
36
+ def execute
53
37
  if instance
54
38
  @ssh = $api.ssh(role, environment, instance)
55
39
  else
@@ -70,209 +54,244 @@ class SshCommand < Clamp::Command
70
54
  File.chmod(0600, '/tmp/gtkey')
71
55
  system "SSH_AUTH_SOCK='' ssh -i /tmp/gtkey admin@#{@ssh['hostname']}"
72
56
  end
57
+
73
58
  end
74
- end
75
59
 
76
- class InfoCommand < Clamp::Command
77
- option ["-r", "--role"], "ROLE", "Role name, e.g. frontend", :required => false
78
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => false
79
- option ["-i", "--instance"], "INSTANCE", "Node instance, leave blank to query avilable nodes", :required => false
80
- option ["-p", "--parseable"], :flag, "Display in non-pretty parseable JSON"
81
- option ["-g", "--grepable"], :flag, "Display in non-pretty grep-friendly text"
60
+ class InfoCommand < Clamp::Command
61
+ option ["-r", "--role"], "ROLE", "Role name, e.g. frontend", :required => false
62
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => false
63
+ option ["-i", "--instance"], "INSTANCE", "Node instance, leave blank to query avilable nodes", :required => false
64
+ option ["-p", "--parseable"], :flag, "Display in non-pretty parseable JSON"
65
+ option ["-g", "--grepable"], :flag, "Display in non-pretty grep-friendly text"
82
66
 
83
- def execute
84
- @nodes = Array.new
85
- if instance
86
- @nodes = [$api.getonenode(instance)]
87
- elsif role && environment
88
- @nodes = $api.getenvroles(role, environment)
89
- elsif role && !environment
90
- @nodes = $api.getrolenodes(role)
91
- else
92
- @nodes = $api.getallnodes()
67
+ def execute
68
+ @nodes = Array.new
69
+ if instance
70
+ @nodes = [$api.getonenode(instance)]
71
+ elsif role && environment
72
+ @nodes = $api.getenvroles(role, environment)
73
+ elsif role && !environment
74
+ @nodes = $api.getrolenodes(role)
75
+ else
76
+ @nodes = $api.getallnodes()
77
+ end
78
+ infohelper(@nodes, parseable?, grepable?)
93
79
  end
94
- infohelper(@nodes, parseable?, grepable?)
95
- end
96
80
 
97
81
 
98
- end
82
+ end
99
83
 
100
- def infohelper(nodes, parseable, grepable)
101
- if parseable
102
- puts nodes.to_json
103
- else
104
- nodes.each do |node|
105
- @host = "#{node['role']}:#{node['environment']}:#{node['instance']}"
106
- unless grepable
107
- puts @host.color(:green)
108
- end
109
- node.keys.each do |key|
110
- if grepable
111
- puts "#{@host}|#{key}|#{node[key]}"
112
- else
113
- unless key == node.keys.last
114
- puts " ┠ #{key.color(:cyan)}: #{node[key]}"
84
+ def infohelper(nodes, parseable, grepable)
85
+ if parseable
86
+ puts nodes.to_json
87
+ else
88
+ nodes.each do |node|
89
+ @host = "#{node['role']}:#{node['environment']}:#{node['instance']}"
90
+ unless grepable
91
+ puts @host.color(:green)
92
+ end
93
+ node.keys.each do |key|
94
+ if grepable
95
+ puts "#{@host}|#{key}|#{node[key]}"
115
96
  else
116
- puts " ┖ #{key.color(:cyan)}: #{node[key]}\n\n"
97
+ unless key == node.keys.last
98
+ puts " ┠ #{key.color(:cyan)}: #{node[key]}"
99
+ else
100
+ puts " ┖ #{key.color(:cyan)}: #{node[key]}\n\n"
101
+ end
117
102
  end
118
103
  end
119
104
  end
120
105
  end
121
106
  end
122
- end
123
107
 
124
- def sshcmd(node, commands)
125
- Net::SSH.start(
126
- node['hostname'],
127
- 'admin',
128
- :key_data => [$api.ssh(node['role'], node['environment'], node['instance'])['key']],
129
- :config => false,
130
- :keys_only => true,
131
- :paranoid => false
132
- ) do |ssh|
133
- commands.each do |command|
134
- command.color(:cyan)
135
- ssh.exec! command do
136
- |ch, stream, line|
137
- puts "#{node['role'].color(:yellow)}:#{node['environment'].color(:yellow)}:#{node['instance'].color(:yellow)}> #{line}"
108
+ def sshcmd(node, commands)
109
+ Net::SSH.start(
110
+ node['hostname'],
111
+ 'admin',
112
+ :key_data => [$api.ssh(node['role'], node['environment'], node['instance'])['key']],
113
+ :config => false,
114
+ :keys_only => true,
115
+ :paranoid => false
116
+ ) do |ssh|
117
+ commands.each do |command|
118
+ command.color(:cyan)
119
+ ssh.exec! command do
120
+ |ch, stream, line|
121
+ puts "#{node['role'].color(:yellow)}:#{node['environment'].color(:yellow)}:#{node['instance'].color(:yellow)}> #{line}"
122
+ end
138
123
  end
139
124
  end
140
125
  end
141
- end
142
126
 
143
127
 
144
- class ChefrunCommand < Clamp::Command
145
- option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
146
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
147
- option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => false
128
+ class ChefrunCommand < Clamp::Command
129
+ option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
130
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
131
+ option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => false
148
132
 
149
- def execute
150
- if !instance.nil?
151
- nodes = [$api.getonenode(instance)]
152
- else
153
- nodes = $api.getenvroles(role, environment)
133
+ def execute
134
+ if !instance.nil?
135
+ nodes = [$api.getonenode(instance)]
136
+ else
137
+ nodes = $api.getenvroles(role, environment)
138
+ end
139
+ nodes.peach do |node|
140
+ json = {
141
+ 'this_server' => "#{role}-#{environment}-#{node['instance']}",
142
+ 'role' => role,
143
+ 'environment' => environment,
144
+ 'app_user' => node['appuser'],
145
+ 'run_list' => [ "recipe[main]" ],
146
+ 'hostname' => node['hostname'],
147
+ 'instance' => node['instance'],
148
+ 'zone' => node['zone'],
149
+ 'itype' => node['itype'],
150
+ 'apps' => eval(node['apps'])
151
+ }.to_json
152
+ commands = [
153
+ "cd ~admin/ops; git pull",
154
+ "echo '#{json}' > ~admin/solo.json",
155
+ "sudo chef-solo -c ~admin/ops/cookbooks/solo.rb -j ~admin/solo.json"
156
+ ]
157
+ sshcmd(node, commands)
158
+ end
154
159
  end
155
- nodes.peach do |node|
156
- json = {
157
- 'this_server' => "#{role}-#{environment}-#{node['instance']}",
158
- 'role' => role,
159
- 'environment' => environment,
160
- 'app_user' => node['appuser'],
161
- 'run_list' => [ "recipe[main]" ],
162
- 'hostname' => node['hostname'],
163
- 'instance' => node['instance'],
164
- 'zone' => node['zone'],
165
- 'itype' => node['itype'],
166
- 'apps' => eval(node['apps'])
167
- }.to_json
168
- commands = [
169
- "cd ~admin/ops; git pull",
170
- "echo '#{json}' > ~admin/solo.json",
171
- "sudo chef-solo -c ~admin/ops/cookbooks/solo.rb -j ~admin/solo.json"
172
- ]
173
- sshcmd(node, commands)
160
+ end
161
+
162
+ class DeployCommand < Clamp::Command
163
+ option ["-a", "--app"], "APP", "Application to deploy", :required => true
164
+ option ["-m", "--migrate"], :flag, "Toggle running migrations"
165
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
166
+ option ["-b", "--branch"], "BRANCH", "Git branch to deploy, default is master", :required => false
167
+ option ["-r", "--rollback"], :flag, "Toggle this to rollback last deploy"
168
+
169
+ def execute
170
+ nodes = $api.getappnodes(app, environment)
171
+ nodes.peach do |node|
172
+ json = {
173
+ 'this_server' => "#{node['role']}-#{environment}-#{node['instance']}",
174
+ 'role' => node['role'],
175
+ 'environment' => environment,
176
+ 'app_user' => node['appuser'],
177
+ 'run_list' => [ "recipe[deploy]" ],
178
+ 'hostname' => node['hostname'],
179
+ 'instance' => node['instance'],
180
+ 'zone' => node['zone'],
181
+ 'itype' => node['itype'],
182
+ 'apps' => eval(node['apps']),
183
+ 'app_name' => app,
184
+ 'app' => app,
185
+ 'rollback' => rollback?,
186
+ 'branch' => branch || 'master',
187
+ 'migrate' => migrate?
188
+ }.to_json
189
+ commands = [
190
+ "cd ~admin/ops; git pull",
191
+ "echo '#{json}' > ~admin/solo.json",
192
+ "sudo chef-solo -c ~admin/ops/cookbooks/solo.rb -j ~admin/solo.json"
193
+ ]
194
+ sshcmd(node, commands)
195
+ end
174
196
  end
175
197
  end
176
- end
177
198
 
178
- class DeployCommand < Clamp::Command
179
- option ["-a", "--app"], "APP", "Application to deploy", :required => true
180
- option ["-m", "--migrate"], :flag, "Toggle running migrations"
181
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
182
- option ["-b", "--branch"], "BRANCH", "Git branch to deploy, default is master", :required => false
183
- option ["-r", "--rollback"], :flag, "Toggle this to rollback last deploy"
199
+ class RegenCommand < Clamp::Command
200
+ option ["-z", "--zone"], "ZONE", "AWS availability zone to put node in", :required => true
201
+ def execute
202
+ nodes = $api.regenhosts(zone)
203
+ end
204
+ end
184
205
 
185
- def execute
186
- nodes = $api.getappnodes(app, environment)
187
- nodes.peach do |node|
188
- json = {
189
- 'this_server' => "#{node['role']}-#{environment}-#{node['instance']}",
190
- 'role' => node['role'],
191
- 'environment' => environment,
192
- 'app_user' => node['appuser'],
193
- 'run_list' => [ "recipe[deploy]" ],
194
- 'hostname' => node['hostname'],
195
- 'instance' => node['instance'],
196
- 'zone' => node['zone'],
197
- 'itype' => node['itype'],
198
- 'apps' => eval(node['apps']),
199
- 'app_name' => app,
200
- 'app' => app,
201
- 'rollback' => rollback?,
202
- 'branch' => branch || 'master',
203
- 'migrate' => migrate?
204
- }.to_json
205
- commands = [
206
- "cd ~admin/ops; git pull",
207
- "echo '#{json}' > ~admin/solo.json",
208
- "sudo chef-solo -c ~admin/ops/cookbooks/solo.rb -j ~admin/solo.json"
209
- ]
210
- sshcmd(node, commands)
206
+ class BalanceCommand < Clamp::Command
207
+ option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
208
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
209
+ def execute
210
+ puts $api.balanceservices(role, environment)
211
211
  end
212
212
  end
213
- end
214
213
 
215
- class RegenCommand < Clamp::Command
216
- option ["-z", "--zone"], "ZONE", "AWS availability zone to put node in", :required => true
217
- def execute
218
- nodes = $api.regenhosts(zone)
214
+ class AddserviceCommand < Clamp::Command
215
+ option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
216
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
217
+ option ["-n", "--name"], "NAME", "Name of the service, e.g. 'twitter'. MUST MATCH UPSTARTD SERVICE NAME.", :required => true
218
+ option ["-w", "--weight"], "WEIGHT", "Relative service weight, for the balancer to chose run location", :required => true
219
+ option ["-y", "--enabled"], :flag, "Enable this service in balance run"
220
+ option ["-k", "--keys"], "KEYS", "Hash of keys that will be written to YAML /tmp/apikeys-<service name>.yml. This will be eval()'d, write it like a ruby hash.", :required => true
221
+ def execute
222
+ if enabled?
223
+ en = 1
224
+ else
225
+ en = 0
226
+ end
227
+ puts $api.addservice(role, environment, name, eval(keys), weight, en)
228
+ end
219
229
  end
220
- end
221
230
 
222
- class BalanceCommand < Clamp::Command
223
- option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
224
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
225
- def execute
226
- puts $api.balanceservices(role, environment)
231
+ class DelserviceCommand < Clamp::Command
232
+ option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
233
+ option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
234
+ option ["-n", "--name"], "NAME", "Name of the service, e.g. 'twitter'. MUST MATCH UPSTARTD SERVICE NAME.", :required => true
235
+ def execute
236
+ puts $api.deleteservice(role, environment, name)
237
+ end
227
238
  end
228
- end
229
239
 
230
- class AddserviceCommand < Clamp::Command
231
- option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
232
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
233
- option ["-n", "--name"], "NAME", "Name of the service, e.g. 'twitter'. MUST MATCH UPSTARTD SERVICE NAME.", :required => true
234
- option ["-w", "--weight"], "WEIGHT", "Relative service weight, for the balancer to chose run location", :required => true
235
- option ["-y", "--enabled"], :flag, "Enable this service in balance run"
236
- option ["-k", "--keys"], "KEYS", "Hash of keys that will be written to YAML /tmp/apikeys-<service name>.yml. This will be eval()'d, write it like a ruby hash.", :required => true
237
- def execute
238
- if enabled?
239
- en = 1
240
- else
241
- en = 0
240
+ class ServicesCommand < Clamp::Command
241
+ def execute
242
+ puts $api.getservices()
242
243
  end
243
- puts $api.addservice(role, environment, name, eval(keys), weight, en)
244
244
  end
245
- end
246
245
 
247
- class DelserviceCommand < Clamp::Command
248
- option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true
249
- option ["-e", "--environment"], "ENVIRONMENT", "Which environment, e.g. production", :required => true
250
- option ["-n", "--name"], "NAME", "Name of the service, e.g. 'twitter'. MUST MATCH UPSTARTD SERVICE NAME.", :required => true
251
- def execute
252
- puts $api.deleteservice(role, environment, name)
246
+ class SvcAPIList < Clamp::Command
247
+ option [ "-s", "--service"], "SERVICE", "Name of the service, omit to show all"
248
+ def execute
249
+ if service.nil?
250
+ puts $api.svcapi_showkeys(:all)
251
+ else
252
+ puts $api.svcapi_showkeys(service)
253
+ end
254
+ end
255
+ end
256
+
257
+ class SvcAPIDelete < Clamp::Command
258
+ option [ "-s", "--service"], "SERVICE", "Name of the service", :required => true
259
+ option [ "-k", "--key" ], "KEY", "string for storing as a key/deleting", :required => true
260
+ def execute
261
+ $api.svcapi_deletekey(service, key)
262
+ end
253
263
  end
254
- end
255
264
 
256
- class ServicesCommand < Clamp::Command
257
- def execute
258
- puts $api.getservices()
265
+ class SvcAPIPut < Clamp::Command
266
+ option [ "-s", "--service"], "SERVICE", "Name of the service", :required => true
267
+ option [ "-k", "--key" ], "KEY", "string for storing as a key/deleting", :required => true
268
+ def execute
269
+ $api.svcapi_putkey(service, key)
270
+ end
259
271
  end
260
- end
261
272
 
262
- class MainCommand < Clamp::Command
273
+ class SvcAPI < Clamp::Command
274
+ subcommand "list", "List keys for a service or all services", SvcAPIList
275
+ subcommand "delete", "Delete key from a service", SvcAPIDelete
276
+ subcommand "put", "Put a new key for a service", SvcAPIPut
277
+ end
278
+
279
+ class MainCommand < Clamp::Command
263
280
 
264
- subcommand "info", "Displays information about nodes", InfoCommand
265
- subcommand "init", "Create new application cluster", InitCommand
266
- subcommand "terminate", "Terminate instance", TerminateCommand
267
- subcommand "ssh", "ssh to cluster host", SshCommand
268
- subcommand "chefrun", "chefrun on a resource pool", ChefrunCommand
269
- subcommand "deploy", "deploy on an application", DeployCommand
270
- subcommand "regen", "regen metadata from aws", RegenCommand
271
- subcommand "balance", "balance services across nodes based on weight", BalanceCommand
272
- subcommand "addservice", "add new service to service framework", AddserviceCommand
273
- subcommand "delservice", "delete last service", DelserviceCommand
274
- subcommand "services", "show all services", ServicesCommand
281
+ subcommand "info", "Displays information about nodes", InfoCommand
282
+ subcommand "init", "Create new application cluster", InitCommand
283
+ subcommand "terminate", "Terminate instance", TerminateCommand
284
+ subcommand "ssh", "ssh to cluster host", SshCommand
285
+ subcommand "chefrun", "chefrun on a resource pool", ChefrunCommand
286
+ subcommand "deploy", "deploy on an application", DeployCommand
287
+ subcommand "regen", "regen metadata from aws", RegenCommand
288
+ subcommand "balance", "balance services across nodes based on weight", BalanceCommand
289
+ subcommand "addservice", "add new service to service framework", AddserviceCommand
290
+ subcommand "delservice", "delete last service", DelserviceCommand
291
+ subcommand "services", "show all services", ServicesCommand
292
+ subcommand "svcapi", "manipulate service API keys/metadata", SvcAPI
275
293
 
294
+ end
276
295
  end
277
296
 
278
- MainCommand.run
297
+ Gaptool::MainCommand.run
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.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-17 00:00:00.000000000 Z
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 0.3.2
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 0.3.2
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: shoulda
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -207,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  segments:
209
209
  - 0
210
- hash: -2205502440360881386
210
+ hash: -1559600565290524055
211
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  none: false
213
213
  requirements: