bosh_cli 0.19.6 → 1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bosh +3 -0
- data/lib/cli.rb +15 -5
- data/lib/cli/{commands/base.rb → base_command.rb} +38 -44
- data/lib/cli/command_discovery.rb +40 -0
- data/lib/cli/command_handler.rb +135 -0
- data/lib/cli/commands/biff.rb +16 -12
- data/lib/cli/commands/blob_management.rb +10 -3
- data/lib/cli/commands/cloudcheck.rb +13 -11
- data/lib/cli/commands/complete.rb +29 -0
- data/lib/cli/commands/deployment.rb +137 -28
- data/lib/cli/commands/help.rb +96 -0
- data/lib/cli/commands/job.rb +4 -1
- data/lib/cli/commands/job_management.rb +36 -23
- data/lib/cli/commands/job_rename.rb +11 -12
- data/lib/cli/commands/log_management.rb +28 -32
- data/lib/cli/commands/maintenance.rb +6 -1
- data/lib/cli/commands/misc.rb +129 -87
- data/lib/cli/commands/package.rb +6 -65
- data/lib/cli/commands/property_management.rb +20 -8
- data/lib/cli/commands/release.rb +211 -206
- data/lib/cli/commands/ssh.rb +178 -188
- data/lib/cli/commands/stemcell.rb +114 -51
- data/lib/cli/commands/task.rb +74 -56
- data/lib/cli/commands/user.rb +6 -3
- data/lib/cli/commands/vms.rb +17 -15
- data/lib/cli/config.rb +27 -1
- data/lib/cli/core_ext.rb +27 -1
- data/lib/cli/deployment_helper.rb +47 -0
- data/lib/cli/director.rb +18 -9
- data/lib/cli/errors.rb +6 -0
- data/lib/cli/job_builder.rb +75 -23
- data/lib/cli/job_property_collection.rb +87 -0
- data/lib/cli/job_property_validator.rb +130 -0
- data/lib/cli/package_builder.rb +32 -5
- data/lib/cli/release.rb +2 -0
- data/lib/cli/release_builder.rb +9 -13
- data/lib/cli/release_compiler.rb +5 -34
- data/lib/cli/release_tarball.rb +4 -19
- data/lib/cli/runner.rb +118 -694
- data/lib/cli/version.rb +1 -1
- data/spec/assets/config/swift-hp/config/final.yml +6 -0
- data/spec/assets/config/swift-hp/config/private.yml +7 -0
- data/spec/assets/config/swift-rackspace/config/final.yml +6 -0
- data/spec/assets/config/swift-rackspace/config/private.yml +6 -0
- data/spec/spec_helper.rb +0 -5
- data/spec/unit/base_command_spec.rb +32 -37
- data/spec/unit/biff_spec.rb +11 -10
- data/spec/unit/cli_commands_spec.rb +96 -88
- data/spec/unit/core_ext_spec.rb +1 -1
- data/spec/unit/deployment_manifest_spec.rb +36 -0
- data/spec/unit/director_spec.rb +17 -3
- data/spec/unit/job_builder_spec.rb +2 -2
- data/spec/unit/job_property_collection_spec.rb +111 -0
- data/spec/unit/job_property_validator_spec.rb +7 -0
- data/spec/unit/job_rename_spec.rb +7 -6
- data/spec/unit/package_builder_spec.rb +2 -2
- data/spec/unit/release_builder_spec.rb +33 -0
- data/spec/unit/release_spec.rb +54 -0
- data/spec/unit/release_tarball_spec.rb +2 -7
- data/spec/unit/runner_spec.rb +1 -151
- data/spec/unit/ssh_spec.rb +15 -9
- metadata +41 -12
- data/lib/cli/command_definition.rb +0 -52
- data/lib/cli/templates/help_message.erb +0 -80
data/spec/unit/ssh_spec.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Bosh::Cli::Command::Base do
|
6
|
+
# TODO: the whole spec needs to be rewritten
|
6
7
|
|
7
8
|
before :all do
|
8
9
|
@public_key = File.join(Dir.mktmpdir, "public_key")
|
@@ -14,7 +15,8 @@ describe Bosh::Cli::Command::Base do
|
|
14
15
|
describe Bosh::Cli::Command::Ssh do
|
15
16
|
it "should get the public key" do
|
16
17
|
ssh = Bosh::Cli::Command::Ssh.new
|
17
|
-
|
18
|
+
ssh.add_option(:public_key, @public_key)
|
19
|
+
public_key = ssh.send(:get_public_key)
|
18
20
|
public_key.should == "PUBLIC_KEY"
|
19
21
|
end
|
20
22
|
|
@@ -23,8 +25,8 @@ describe Bosh::Cli::Command::Base do
|
|
23
25
|
ssh = Bosh::Cli::Command::Ssh.new
|
24
26
|
public_key = nil
|
25
27
|
begin
|
26
|
-
public_key = ssh.get_public_key
|
27
|
-
rescue Bosh::Cli::
|
28
|
+
public_key = ssh.send(:get_public_key)
|
29
|
+
rescue Bosh::Cli::CliError
|
28
30
|
public_key = "SOMETHING"
|
29
31
|
end
|
30
32
|
public_key.should_not be_nil
|
@@ -32,15 +34,19 @@ describe Bosh::Cli::Command::Base do
|
|
32
34
|
|
33
35
|
it "should contact director to setup ssh on the job" do
|
34
36
|
mock_director = mock(Object)
|
35
|
-
mock_director.stub(:setup_ssh).and_return([
|
36
|
-
|
37
|
+
mock_director.stub(:setup_ssh).and_return([:done, 42])
|
38
|
+
|
39
|
+
mock_director.stub(:get_task_result_log).with(42).
|
40
|
+
and_return(JSON.generate(
|
41
|
+
[{ "status" => "success", "ip" => "127.0.0.1" }]))
|
37
42
|
mock_director.stub(:cleanup_ssh)
|
38
43
|
Bosh::Cli::Director.should_receive(:new).and_return(mock_director)
|
39
44
|
ssh = Bosh::Cli::Command::Ssh.new
|
40
45
|
ssh.stub(:prepare_deployment_manifest).and_return("test")
|
41
46
|
ssh.stub(:cleanup_ssh)
|
42
|
-
ssh.
|
43
|
-
|
47
|
+
ssh.stub(:get_public_key).and_return("PUBKEY")
|
48
|
+
ssh.send(
|
49
|
+
:setup_ssh, "dea", 0, "temp_pass") do |results, _, _|
|
44
50
|
results.each do |result|
|
45
51
|
result["status"].should == "success"
|
46
52
|
result["ip"].should == "127.0.0.1"
|
@@ -62,7 +68,7 @@ describe Bosh::Cli::Command::Base do
|
|
62
68
|
ssh = Bosh::Cli::Command::Ssh.new
|
63
69
|
lambda {
|
64
70
|
ssh.shell("dea")
|
65
|
-
}.should raise_error(Bosh::Cli::
|
71
|
+
}.should raise_error(Bosh::Cli::CliError)
|
66
72
|
end
|
67
73
|
|
68
74
|
it "should try to execute given command remotely" do
|
@@ -70,7 +76,7 @@ describe Bosh::Cli::Command::Base do
|
|
70
76
|
@interactive_shell = false
|
71
77
|
@execute_command = false
|
72
78
|
ssh.stub(:setup_interactive_shell) { @interactive_shell = true }
|
73
|
-
ssh.stub(:
|
79
|
+
ssh.stub(:perform_operation) { @execute_command = true }
|
74
80
|
ssh.shell("dea", "ls -l")
|
75
81
|
@interactive_shell.should == false && @execute_command.should == true
|
76
82
|
end
|
metadata
CHANGED
@@ -1,16 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.rc1
|
5
|
+
prerelease: 4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- VMware
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bosh_common
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.5.1
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: json_pure
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,15 +202,18 @@ extra_rdoc_files: []
|
|
186
202
|
files:
|
187
203
|
- bin/bosh
|
188
204
|
- lib/cli.rb
|
205
|
+
- lib/cli/base_command.rb
|
189
206
|
- lib/cli/blob_manager.rb
|
190
207
|
- lib/cli/cache.rb
|
191
208
|
- lib/cli/changeset_helper.rb
|
192
|
-
- lib/cli/
|
193
|
-
- lib/cli/
|
209
|
+
- lib/cli/command_discovery.rb
|
210
|
+
- lib/cli/command_handler.rb
|
194
211
|
- lib/cli/commands/biff.rb
|
195
212
|
- lib/cli/commands/blob_management.rb
|
196
213
|
- lib/cli/commands/cloudcheck.rb
|
214
|
+
- lib/cli/commands/complete.rb
|
197
215
|
- lib/cli/commands/deployment.rb
|
216
|
+
- lib/cli/commands/help.rb
|
198
217
|
- lib/cli/commands/job.rb
|
199
218
|
- lib/cli/commands/job_management.rb
|
200
219
|
- lib/cli/commands/job_rename.rb
|
@@ -219,6 +238,8 @@ files:
|
|
219
238
|
- lib/cli/errors.rb
|
220
239
|
- lib/cli/event_log_renderer.rb
|
221
240
|
- lib/cli/job_builder.rb
|
241
|
+
- lib/cli/job_property_collection.rb
|
242
|
+
- lib/cli/job_property_validator.rb
|
222
243
|
- lib/cli/null_renderer.rb
|
223
244
|
- lib/cli/package_builder.rb
|
224
245
|
- lib/cli/packaging_helper.rb
|
@@ -230,7 +251,6 @@ files:
|
|
230
251
|
- lib/cli/stemcell.rb
|
231
252
|
- lib/cli/task_log_renderer.rb
|
232
253
|
- lib/cli/task_tracker.rb
|
233
|
-
- lib/cli/templates/help_message.erb
|
234
254
|
- lib/cli/validation.rb
|
235
255
|
- lib/cli/version.rb
|
236
256
|
- lib/cli/version_calc.rb
|
@@ -256,6 +276,10 @@ files:
|
|
256
276
|
- spec/assets/config/deprecation/config/private.yml
|
257
277
|
- spec/assets/config/s3/config/final.yml
|
258
278
|
- spec/assets/config/s3/config/private.yml
|
279
|
+
- spec/assets/config/swift-hp/config/final.yml
|
280
|
+
- spec/assets/config/swift-hp/config/private.yml
|
281
|
+
- spec/assets/config/swift-rackspace/config/final.yml
|
282
|
+
- spec/assets/config/swift-rackspace/config/private.yml
|
259
283
|
- spec/assets/deployment.MF
|
260
284
|
- spec/assets/plugins/bosh/cli/commands/echo.rb
|
261
285
|
- spec/assets/plugins/bosh/cli/commands/ruby.rb
|
@@ -300,6 +324,8 @@ files:
|
|
300
324
|
- spec/unit/event_log_renderer_spec.rb
|
301
325
|
- spec/unit/hash_changeset_spec.rb
|
302
326
|
- spec/unit/job_builder_spec.rb
|
327
|
+
- spec/unit/job_property_collection_spec.rb
|
328
|
+
- spec/unit/job_property_validator_spec.rb
|
303
329
|
- spec/unit/job_rename_spec.rb
|
304
330
|
- spec/unit/package_builder_spec.rb
|
305
331
|
- spec/unit/release_builder_spec.rb
|
@@ -325,16 +351,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
325
351
|
version: '0'
|
326
352
|
segments:
|
327
353
|
- 0
|
328
|
-
hash: -
|
354
|
+
hash: -4439490482070871500
|
329
355
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
330
356
|
none: false
|
331
357
|
requirements:
|
332
|
-
- - ! '
|
358
|
+
- - ! '>'
|
333
359
|
- !ruby/object:Gem::Version
|
334
|
-
version:
|
335
|
-
segments:
|
336
|
-
- 0
|
337
|
-
hash: -389599683879577066
|
360
|
+
version: 1.3.1
|
338
361
|
requirements: []
|
339
362
|
rubyforge_project:
|
340
363
|
rubygems_version: 1.8.24
|
@@ -360,6 +383,10 @@ test_files:
|
|
360
383
|
- spec/assets/config/deprecation/config/private.yml
|
361
384
|
- spec/assets/config/s3/config/final.yml
|
362
385
|
- spec/assets/config/s3/config/private.yml
|
386
|
+
- spec/assets/config/swift-hp/config/final.yml
|
387
|
+
- spec/assets/config/swift-hp/config/private.yml
|
388
|
+
- spec/assets/config/swift-rackspace/config/final.yml
|
389
|
+
- spec/assets/config/swift-rackspace/config/private.yml
|
363
390
|
- spec/assets/deployment.MF
|
364
391
|
- spec/assets/plugins/bosh/cli/commands/echo.rb
|
365
392
|
- spec/assets/plugins/bosh/cli/commands/ruby.rb
|
@@ -404,6 +431,8 @@ test_files:
|
|
404
431
|
- spec/unit/event_log_renderer_spec.rb
|
405
432
|
- spec/unit/hash_changeset_spec.rb
|
406
433
|
- spec/unit/job_builder_spec.rb
|
434
|
+
- spec/unit/job_property_collection_spec.rb
|
435
|
+
- spec/unit/job_property_validator_spec.rb
|
407
436
|
- spec/unit/job_rename_spec.rb
|
408
437
|
- spec/unit/package_builder_spec.rb
|
409
438
|
- spec/unit/release_builder_spec.rb
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
|
-
module Bosh::Cli
|
4
|
-
class CommandDefinition
|
5
|
-
attr_reader :options
|
6
|
-
attr_reader :power_options
|
7
|
-
attr_reader :keywords
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@options = []
|
11
|
-
@power_options = []
|
12
|
-
@hints = []
|
13
|
-
@keywords = []
|
14
|
-
end
|
15
|
-
|
16
|
-
def usage(str = nil)
|
17
|
-
if str
|
18
|
-
@usage = str.strip
|
19
|
-
@keywords = str.split(/\s+/).select do |word|
|
20
|
-
word.match(/^[a-z]/i)
|
21
|
-
end
|
22
|
-
else
|
23
|
-
@usage
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def description(str = nil)
|
28
|
-
str ? (@description = str.to_s.strip) : @description
|
29
|
-
end
|
30
|
-
|
31
|
-
alias :desc :description
|
32
|
-
|
33
|
-
def option(name, value = "")
|
34
|
-
@options << [name, value]
|
35
|
-
end
|
36
|
-
|
37
|
-
def power_option(name, value = "")
|
38
|
-
@power_options << [name, value]
|
39
|
-
end
|
40
|
-
|
41
|
-
def route(*args, &block)
|
42
|
-
if args.size > 0
|
43
|
-
@route = args
|
44
|
-
elsif block_given?
|
45
|
-
@route = block
|
46
|
-
else
|
47
|
-
@route
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
@@ -1,80 +0,0 @@
|
|
1
|
-
<%= basic_usage %>
|
2
|
-
Currently available bosh commands are:
|
3
|
-
|
4
|
-
Deployment
|
5
|
-
<%= command_usage(:deployment) %>
|
6
|
-
<%= command_usage(:delete_deployment) %>
|
7
|
-
<%= command_usage(:list_deployments) %>
|
8
|
-
<%= command_usage(:deploy) %>
|
9
|
-
<%= command_usage(:diff) %>
|
10
|
-
|
11
|
-
Release management
|
12
|
-
<%= command_usage(:create_release) %>
|
13
|
-
<%= command_usage(:delete_release) %>
|
14
|
-
<%= command_usage(:verify_release) %>
|
15
|
-
<%= command_usage(:upload_release) %>
|
16
|
-
<%= command_usage(:list_releases) %>
|
17
|
-
<%= command_usage(:reset_release) %>
|
18
|
-
|
19
|
-
<%= command_usage(:init_release) %>
|
20
|
-
<%= command_usage(:generate_package) %>
|
21
|
-
<%= command_usage(:generate_job) %>
|
22
|
-
|
23
|
-
Stemcells
|
24
|
-
<%= command_usage(:upload_stemcell) %>
|
25
|
-
<%= command_usage(:verify_stemcell) %>
|
26
|
-
<%= command_usage(:list_stemcells) %>
|
27
|
-
<%= command_usage(:delete_stemcell) %>
|
28
|
-
<%= command_usage(:list_public_stemcells) %>
|
29
|
-
<%= command_usage(:download_public_stemcell) %>
|
30
|
-
|
31
|
-
User management
|
32
|
-
<%= command_usage(:create_user) %>
|
33
|
-
|
34
|
-
Job management
|
35
|
-
<%= command_usage(:start_job) %>
|
36
|
-
<%= command_usage(:stop_job) %>
|
37
|
-
<%= command_usage(:restart_job) %>
|
38
|
-
<%= command_usage(:recreate_job) %>
|
39
|
-
<%= command_usage(:rename_job) %>
|
40
|
-
|
41
|
-
Log management
|
42
|
-
<%= command_usage(:fetch_logs) %>
|
43
|
-
|
44
|
-
Task management
|
45
|
-
<%= command_usage(:list_running_tasks) %>
|
46
|
-
<%= command_usage(:list_recent_tasks) %>
|
47
|
-
<%= command_usage(:track_task) %>
|
48
|
-
<%= command_usage(:cancel_task) %>
|
49
|
-
|
50
|
-
Property management
|
51
|
-
<%= command_usage(:set_property) %>
|
52
|
-
<%= command_usage(:get_property) %>
|
53
|
-
<%= command_usage(:unset_property) %>
|
54
|
-
<%= command_usage(:list_properties) %>
|
55
|
-
|
56
|
-
Maintenance
|
57
|
-
<%= command_usage(:cleanup) %>
|
58
|
-
<%= command_usage(:cloudcheck) %>
|
59
|
-
|
60
|
-
Misc
|
61
|
-
<%= command_usage(:status) %>
|
62
|
-
<%= command_usage(:list_vms) %>
|
63
|
-
<%= command_usage(:target) %>
|
64
|
-
<%= command_usage(:list_targets) %>
|
65
|
-
<%= command_usage(:login) %>
|
66
|
-
<%= command_usage(:logout) %>
|
67
|
-
<%= command_usage(:alias) %>
|
68
|
-
<%= command_usage(:list_aliases) %>
|
69
|
-
<%= command_usage(:purge) %>
|
70
|
-
|
71
|
-
Remote access
|
72
|
-
<%= command_usage(:ssh) %>
|
73
|
-
<%= command_usage(:scp) %>
|
74
|
-
<%= command_usage(:ssh_cleanup) %>
|
75
|
-
|
76
|
-
Blob
|
77
|
-
<%= command_usage(:add_blob) %>
|
78
|
-
<%= command_usage(:upload_blobs) %>
|
79
|
-
<%= command_usage(:sync_blobs) %>
|
80
|
-
<%= command_usage(:blobs_status) %>
|