bosh_cli 1.3146.10.0 → 1.3147.0
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/lib/cli/base_command.rb +0 -7
- data/lib/cli/commands/job_management.rb +6 -10
- data/lib/cli/commands/log_management.rb +1 -3
- data/lib/cli/commands/ssh.rb +0 -5
- data/lib/cli/commands/vm.rb +0 -3
- data/lib/cli/deployment_helper.rb +0 -4
- data/lib/cli/release_tarball.rb +13 -63
- data/lib/cli/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af72447c3783652381af6e46241865c048dacba
|
4
|
+
data.tar.gz: 2fcf5235942a879dcafdf03b7561a9d6cc7d64a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95dab00041cb7a86a7b5f3c6475154c3c46910555cd892afc81f3426cb66effce7d1bbc53e642d04fe87c18c62a57ab787a8a618faa154385d9f5734b3aa9102
|
7
|
+
data.tar.gz: 1aa30f427fde8d48750ff3dd1581822bbd46a5c0e8b493f07f09cf47f57934a6c836ba2ea2893b0249db97b1da0f6d4a6dcfd3969cf6fbacf84b81f4ca1fa56b
|
data/lib/cli/base_command.rb
CHANGED
@@ -260,13 +260,6 @@ module Bosh::Cli
|
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
def valid_index_for(manifest_hash, job, index, options = {})
|
264
|
-
index = '0' if job_unique_in_deployment?(manifest_hash, job)
|
265
|
-
err('You should specify the job index. There is more than one instance of this job type.') if index.nil?
|
266
|
-
index = index.to_i if options[:integer_index]
|
267
|
-
index
|
268
|
-
end
|
269
|
-
|
270
263
|
def normalize_url(url)
|
271
264
|
url = url.gsub(/\/$/, '')
|
272
265
|
url = "https://#{url}" unless url.match(/^http:?/)
|
@@ -9,9 +9,9 @@ module Bosh::Cli
|
|
9
9
|
|
10
10
|
# bosh start
|
11
11
|
usage 'start'
|
12
|
-
desc 'Start job/instance'
|
12
|
+
desc 'Start all jobs/job/instance'
|
13
13
|
option '--force', FORCE
|
14
|
-
def start_job(job, index = nil)
|
14
|
+
def start_job(job = '*', index = nil)
|
15
15
|
change_job_state(:start, job, index)
|
16
16
|
end
|
17
17
|
|
@@ -32,19 +32,19 @@ module Bosh::Cli
|
|
32
32
|
|
33
33
|
# bosh restart
|
34
34
|
usage 'restart'
|
35
|
-
desc 'Restart job/instance (soft stop + start)'
|
35
|
+
desc 'Restart all jobs/job/instance (soft stop + start)'
|
36
36
|
option '--force', FORCE
|
37
37
|
option '--skip-drain', SKIP_DRAIN
|
38
|
-
def restart_job(job, index = nil)
|
38
|
+
def restart_job(job = '*', index = nil)
|
39
39
|
change_job_state(:restart, job, index)
|
40
40
|
end
|
41
41
|
|
42
42
|
# bosh recreate
|
43
43
|
usage 'recreate'
|
44
|
-
desc 'Recreate job/instance (hard stop + start)'
|
44
|
+
desc 'Recreate all jobs/job/instance (hard stop + start)'
|
45
45
|
option '--force', FORCE
|
46
46
|
option '--skip-drain', SKIP_DRAIN
|
47
|
-
def recreate_job(job, index = nil)
|
47
|
+
def recreate_job(job = '*', index = nil)
|
48
48
|
change_job_state(:recreate, job, index)
|
49
49
|
end
|
50
50
|
|
@@ -53,10 +53,6 @@ module Bosh::Cli
|
|
53
53
|
def change_job_state(state, job, index = nil)
|
54
54
|
auth_required
|
55
55
|
manifest = parse_manifest(state)
|
56
|
-
unless job == '*'
|
57
|
-
job_must_exist_in_deployment(manifest.hash, job)
|
58
|
-
index = valid_index_for(manifest.hash, job, index) unless state == :stop || state == :detach
|
59
|
-
end
|
60
56
|
job_state = JobState.new(self, manifest, skip_drain: skip_drain?)
|
61
57
|
status, task_id, completion_desc = job_state.change(state, job, index, force?)
|
62
58
|
task_report(status, task_id, completion_desc)
|
@@ -11,11 +11,10 @@ module Bosh::Cli::Command
|
|
11
11
|
option '--dir destination_directory', String, 'download directory'
|
12
12
|
option '--all', 'deprecated'
|
13
13
|
|
14
|
-
def fetch_logs(job, index
|
14
|
+
def fetch_logs(job, index)
|
15
15
|
auth_required
|
16
16
|
|
17
17
|
manifest = prepare_deployment_manifest(show_state: true)
|
18
|
-
index = valid_index_for(manifest.hash, job, index)
|
19
18
|
check_arguments(index)
|
20
19
|
|
21
20
|
logs_downloader = Bosh::Cli::LogsDownloader.new(director, self)
|
@@ -76,4 +75,3 @@ module Bosh::Cli::Command
|
|
76
75
|
end
|
77
76
|
end
|
78
77
|
end
|
79
|
-
|
data/lib/cli/commands/ssh.rb
CHANGED
@@ -27,9 +27,6 @@ module Bosh::Cli
|
|
27
27
|
end
|
28
28
|
|
29
29
|
manifest = prepare_deployment_manifest(show_state: true)
|
30
|
-
job_must_exist_in_deployment(manifest.hash, job)
|
31
|
-
|
32
|
-
index = valid_index_for(manifest.hash, job, index, integer_index: true)
|
33
30
|
|
34
31
|
if command.empty?
|
35
32
|
setup_interactive_shell(manifest.name, job, index)
|
@@ -60,7 +57,6 @@ module Bosh::Cli
|
|
60
57
|
end
|
61
58
|
|
62
59
|
manifest = prepare_deployment_manifest(show_state: true)
|
63
|
-
job_must_exist_in_deployment(manifest.hash, job)
|
64
60
|
|
65
61
|
if args.size != 2
|
66
62
|
err('Please enter valid source and destination paths')
|
@@ -79,7 +75,6 @@ module Bosh::Cli
|
|
79
75
|
end
|
80
76
|
|
81
77
|
manifest = prepare_deployment_manifest(show_state: true)
|
82
|
-
job_must_exist_in_deployment(manifest.hash, job)
|
83
78
|
|
84
79
|
say("Cleaning up ssh artifacts from #{job}/#{index}")
|
85
80
|
director.cleanup_ssh(manifest.name, job, "^#{SSH_USER_PREFIX}", [index])
|
data/lib/cli/commands/vm.rb
CHANGED
@@ -20,9 +20,6 @@ module Bosh::Cli
|
|
20
20
|
resurrection = Resurrection.new(new_state)
|
21
21
|
|
22
22
|
manifest = prepare_deployment_manifest(show_state: true)
|
23
|
-
job_must_exist_in_deployment(manifest.hash, job)
|
24
|
-
index = valid_index_for(manifest.hash, job, index, integer_index: true)
|
25
|
-
|
26
23
|
director.change_vm_resurrection(manifest.name, job, index, resurrection.paused?)
|
27
24
|
end
|
28
25
|
end
|
@@ -128,10 +128,6 @@ module Bosh::Cli
|
|
128
128
|
!!find_job(manifest_hash, job_name)
|
129
129
|
end
|
130
130
|
|
131
|
-
def job_must_exist_in_deployment(manifest_hash, job)
|
132
|
-
err("Job `#{job}' doesn't exist") unless job_exists_in_deployment?(manifest_hash, job)
|
133
|
-
end
|
134
|
-
|
135
131
|
def prompt_for_job_and_index
|
136
132
|
jobs_list = jobs_and_indexes
|
137
133
|
|
data/lib/cli/release_tarball.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'open3'
|
2
|
-
|
3
1
|
module Bosh::Cli
|
4
2
|
class ReleaseTarball
|
5
3
|
include Validation
|
@@ -23,84 +21,36 @@ module Bosh::Cli
|
|
23
21
|
|
24
22
|
def unpack_manifest
|
25
23
|
return @unpacked_manifest unless @unpacked_manifest.nil?
|
26
|
-
exit_success =
|
24
|
+
exit_success = fast_unpack('./release.MF')
|
27
25
|
@unpacked_manifest = !!exit_success
|
28
26
|
end
|
29
27
|
|
30
28
|
def unpack_jobs
|
31
29
|
return @unpacked_jobs unless @unpacked_jobs.nil?
|
32
|
-
exit_success =
|
33
|
-
unless all_release_jobs_unpacked?
|
34
|
-
exit_success = safe_unpack('./jobs/')
|
35
|
-
end
|
30
|
+
exit_success = fast_unpack('./jobs/')
|
36
31
|
@unpacked_jobs = !!exit_success
|
37
32
|
end
|
38
33
|
|
39
34
|
def unpack_license
|
40
35
|
return @unpacked_license unless @unpacked_license.nil?
|
41
|
-
exit_success =
|
36
|
+
exit_success = fast_unpack('./license.tgz')
|
42
37
|
@unpacked_license = !!exit_success
|
43
38
|
end
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
exit_status = raw_fast_unpack(processed_target)
|
52
|
-
end
|
53
|
-
exit_status
|
54
|
-
end
|
55
|
-
|
56
|
-
def safe_unpack(target)
|
57
|
-
exit_status = raw_unpack(target)
|
58
|
-
if !exit_status
|
59
|
-
processed_target = handle_dot_slash_prefix(target)
|
60
|
-
exit_status = raw_unpack(processed_target)
|
61
|
-
end
|
62
|
-
exit_status
|
63
|
-
end
|
64
|
-
|
65
|
-
# This will [add or remove] the './' when trying to extract a specific file from archive
|
66
|
-
def handle_dot_slash_prefix(target)
|
67
|
-
if target =~ /^\.\/.*/
|
68
|
-
target.sub!(/^\.\//, '')
|
69
|
-
else
|
70
|
-
target.prepend("./")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def raw_fast_unpack(target)
|
75
|
-
tar_version, _, _ = Open3.capture3('tar', '--version')
|
76
|
-
|
77
|
-
case tar_version
|
78
|
-
when /.*gnu.*/i
|
79
|
-
Kernel.system("tar", "-C", @unpack_dir, "-xzf", @tarball_path, "--occurrence", "#{target}", out: "/dev/null", err: "/dev/null")
|
80
|
-
when /.*bsd.*/i
|
81
|
-
if target[-1, 1] == "/"
|
82
|
-
raw_unpack(target)
|
83
|
-
else
|
84
|
-
Kernel.system("tar", "-C", @unpack_dir, "--fast-read", "-xzf", @tarball_path, "#{target}", out: "/dev/null", err: "/dev/null")
|
85
|
-
end
|
40
|
+
def fast_unpack(target)
|
41
|
+
if RUBY_PLATFORM =~ /linux/
|
42
|
+
system("tar", "-C", @unpack_dir, "-xzf", @tarball_path, "--occurrence", "#{target}", out: "/dev/null", err: "/dev/null")
|
43
|
+
elsif RUBY_PLATFORM =~ /darwin/
|
44
|
+
if target[-1, 1] == "/"
|
45
|
+
system("tar", "-C", @unpack_dir, "-xzf", @tarball_path, "#{target}", out: "/dev/null", err: "/dev/null")
|
86
46
|
else
|
87
|
-
|
47
|
+
system("tar", "-C", @unpack_dir, "--fast-read", "-xzf", @tarball_path, "#{target}", out: "/dev/null", err: "/dev/null")
|
48
|
+
end
|
49
|
+
else
|
50
|
+
system("tar", "-C", @unpack_dir, "-xzf", @tarball_path, "#{target}", out: "/dev/null", err: "/dev/null")
|
88
51
|
end
|
89
52
|
end
|
90
53
|
|
91
|
-
def raw_unpack(target)
|
92
|
-
Kernel.system("tar", "-C", @unpack_dir, "-xzf", @tarball_path, "#{target}", out: "/dev/null", err: "/dev/null")
|
93
|
-
end
|
94
|
-
|
95
|
-
# verifies that all jobs in release manifest were unpacked
|
96
|
-
def all_release_jobs_unpacked?
|
97
|
-
return false if manifest_yaml['jobs'].nil?
|
98
|
-
|
99
|
-
manifest_job_names = manifest_yaml['jobs'].map { |j| j['name'] }.sort
|
100
|
-
unpacked_job_file_names = Dir.glob(File.join(@unpack_dir, 'jobs', '*')).map { |f| File.basename(f, '.*') }.sort
|
101
|
-
unpacked_job_file_names == manifest_job_names
|
102
|
-
end
|
103
|
-
|
104
54
|
# Unpacks tarball to @unpack_dir, returns true if succeeded, false if failed
|
105
55
|
def unpack
|
106
56
|
return @unpacked unless @unpacked.nil?
|
data/lib/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3147.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_common
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.3147.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.3147.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bosh-template
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.3147.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.3147.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cf-uaa-lib
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.3147.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: 1.3147.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: net-ssh
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|