bosh_cli 1.3016.0 → 1.3022.0

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: 8b607dc8ab9aeeb90179e6ef059af96cb5a3f918
4
- data.tar.gz: 095a9a73de111b6db264a3b1b8593ac199d3c996
3
+ metadata.gz: 6aa4b94a31d6b9cb57254332d70d2ecba1705b7e
4
+ data.tar.gz: 01fc768fedefe96eb9429c85717fac4ec420416c
5
5
  SHA512:
6
- metadata.gz: 40d909ef8dfd025a620e97589b080cc5c604080f27359d370502a2e000308a991ffe38ee1238de5e4d4147731d9d2597dca3dabcdca039b8f647ca4207f7dfd7
7
- data.tar.gz: 8e007a9ced2e7393ae3cd3878d5c1db7ba6958c463b47250fa317fdad6022394d77235a70b025e4f4bf041d6db2c2cbc30b06f1155614e77b8a52e7a7e4ef756
6
+ metadata.gz: 7da0c31dd8af0357a07af50bb6c986f57e60ac16dde1dad720816e4f820fa5dfd82391df514380e0558db6fec28ce905259ff75e0be2050d9eda822b06040c03
7
+ data.tar.gz: 7d7b108c19c985b0a874920c2085d5e77ebba323dbd8cb5a284458da4311a41cb46e147a034cee735795e3a20756869f97f46150bc3e816bd31f4b5a77497be3
@@ -55,7 +55,7 @@ module Bosh::Cli
55
55
  FileUtils.mkdir_p(dest_path)
56
56
  else
57
57
  FileUtils.mkdir_p(dest_path.parent)
58
- FileUtils.cp(src, dest_path, :preserve => true)
58
+ FileUtils.cp(src, dest_path, preserve: true)
59
59
  end
60
60
  end
61
61
  end
@@ -118,8 +118,6 @@ module Bosh::Cli
118
118
  Dir.chdir(staging_dir) { yield }
119
119
  end
120
120
 
121
- private
122
-
123
121
  def safe_temp_file(prefix, suffix, dir = Dir.tmpdir)
124
122
  Dir::Tmpname.create([prefix, suffix], dir) do |tmpname, _, _|
125
123
  File.open(tmpname, File::RDWR|File::CREAT|File::EXCL).close
@@ -127,7 +127,7 @@ module Bosh::Cli
127
127
  msg = "Acting as #{user_desc} '#{credentials.username.to_s.make_green}'"
128
128
  msg += " on deployment '#{deployment_name.make_green}'" if deployment_name
129
129
  msg += " on '#{target_name.make_green}'" if target_name
130
- say(msg)
130
+ warn(msg)
131
131
  end
132
132
 
133
133
  protected
@@ -613,7 +613,7 @@ module Bosh
613
613
 
614
614
  def releases_path(options = {})
615
615
  path = '/releases'
616
- params = [:rebase, :skip_if_exists].select { |p| options[p] }.map { |p| "#{p}=true" }
616
+ params = [:rebase, :skip_if_exists, :compiled].select { |p| options[p] }.map { |p| "#{p}=true" }
617
617
  path << "?#{params.join('&')}" unless params.empty?
618
618
  path
619
619
  end
@@ -1,5 +1,6 @@
1
1
  require 'cli/name_version_pair'
2
2
  require 'cli/client/export_release_client'
3
+ require 'json'
3
4
 
4
5
  module Bosh::Cli::Command
5
6
  module Release
@@ -21,6 +22,33 @@ module Bosh::Cli::Command
21
22
  client = Bosh::Cli::Client::ExportReleaseClient.new(director)
22
23
  status, task_id = client.export(manifest.name, release.name, release.version, stemcell_os, stemcell.version)
23
24
  task_report(status, task_id)
25
+
26
+ task_result_file = director.get_task_result_log(task_id)
27
+ task_result = JSON.parse(task_result_file)
28
+ tarball_blobstore_id = task_result['blobstore_id']
29
+ tarball_sha1 = task_result['sha1']
30
+
31
+ tarball_file_name = "release-#{release.name}-#{release.version}-on-#{stemcell_os}-stemcell-#{stemcell.version}.tgz"
32
+ tarball_file_path = File.join(Dir.pwd, tarball_file_name)
33
+
34
+ nl
35
+ progress_renderer.start(tarball_file_name, "downloading...")
36
+ tmpfile = director.download_resource(tarball_blobstore_id)
37
+ File.open(tarball_file_path, "wb") do |file|
38
+ file << File.open(tmpfile).read
39
+ end
40
+ progress_renderer.finish(tarball_file_name, "downloaded")
41
+
42
+ if file_checksum(tarball_file_path) != tarball_sha1
43
+ err("Checksum mismatch for downloaded blob `#{tarball_file_path}'")
44
+ end
45
+
46
+ end
47
+
48
+ # Returns file SHA1 checksum
49
+ # @param [String] path File path
50
+ def file_checksum(path)
51
+ Digest::SHA1.file(path).hexdigest
24
52
  end
25
53
  end
26
54
  end
@@ -132,9 +132,10 @@ module Bosh::Cli::Command
132
132
  report = 'Release rebased'
133
133
  else
134
134
  say("\nUploading release\n")
135
- report = 'Release uploaded'
135
+ report = tarball.compiled_release? ? 'Compiled Release uploaded' : 'Release uploaded'
136
136
  end
137
- status, task_id = director.upload_release(tarball_path, rebase: rebase)
137
+
138
+ status, task_id = director.upload_release(tarball_path, {rebase: rebase, compiled: tarball.compiled_release?})
138
139
  task_report(status, task_id, report)
139
140
  end
140
141
 
@@ -6,11 +6,20 @@ module Bosh::Cli
6
6
  attr_reader :release_name, :jobs, :packages, :version
7
7
  attr_reader :skipped, :unpack_dir # Mostly for tests
8
8
 
9
+ @compiled_release = false
10
+ @packages_folder = "packages"
11
+
9
12
  def initialize(tarball_path)
10
13
  @tarball_path = File.expand_path(tarball_path, Dir.pwd)
11
14
  @unpack_dir = Dir.mktmpdir
12
15
  @jobs = []
13
16
  @packages = []
17
+
18
+ if compiled_release?
19
+ @packages_folder = "compiled_packages"
20
+ else
21
+ @packages_folder = "packages"
22
+ end
14
23
  end
15
24
 
16
25
  # Unpacks tarball to @unpack_dir, returns true if succeeded, false if failed
@@ -36,6 +45,11 @@ module Bosh::Cli
36
45
  File.read(File.join(@unpack_dir, "release.MF"))
37
46
  end
38
47
 
48
+ def compiled_release?
49
+ unpack
50
+ File.exists?(File.expand_path("compiled_packages", @unpack_dir))
51
+ end
52
+
39
53
  def replace_manifest(hash)
40
54
  return nil unless valid?
41
55
  unpack
@@ -91,7 +105,7 @@ module Bosh::Cli
91
105
 
92
106
  manifest = load_yaml_file(File.join(@unpack_dir, "release.MF"))
93
107
 
94
- local_packages = manifest["packages"]
108
+ local_packages = manifest[@packages_folder]
95
109
  local_jobs = manifest["jobs"]
96
110
 
97
111
  @skipped = 0
@@ -99,7 +113,8 @@ module Bosh::Cli
99
113
  Dir.chdir(@unpack_dir) do
100
114
  local_packages.each do |package|
101
115
  say("#{package["name"]} (#{package["version"]})".ljust(30), " ")
102
- if package_matches.include?(package["sha1"]) ||
116
+
117
+ if package_matches and package_matches.include?(package["sha1"]) ||
103
118
  (package["fingerprint"] &&
104
119
  package_matches.include?(package["fingerprint"]))
105
120
  say("SKIP".make_green)
@@ -157,15 +172,14 @@ module Bosh::Cli
157
172
  @version = manifest["version"].to_s
158
173
 
159
174
  # Check packages
160
- total_packages = manifest["packages"].size
175
+ total_packages = manifest[@packages_folder].size
161
176
  available_packages = {}
162
177
 
163
- manifest["packages"].each_with_index do |package, i|
178
+ manifest[@packages_folder].each_with_index do |package, i|
164
179
  @packages << package
165
180
  name, version = package['name'], package['version']
166
181
 
167
- package_file = File.expand_path(name + ".tgz",
168
- @unpack_dir + "/packages")
182
+ package_file = File.expand_path(name + ".tgz", File.join(@unpack_dir, @packages_folder))
169
183
  package_exists = File.exists?(package_file)
170
184
 
171
185
  step("Read package '%s' (%d of %d)" % [name, i+1, total_packages],
@@ -190,7 +204,7 @@ module Bosh::Cli
190
204
  step("Package dependencies",
191
205
  "Package dependencies couldn't be resolved") do
192
206
  begin
193
- tsort_packages(manifest["packages"].inject({}) { |h, p|
207
+ tsort_packages(manifest[@packages_folder].inject({}) { |h, p|
194
208
  h[p["name"]] = p["dependencies"] || []; h })
195
209
  true
196
210
  rescue Bosh::Cli::CircularDependency,
@@ -328,11 +342,11 @@ module Bosh::Cli
328
342
 
329
343
  say("\nPackages")
330
344
 
331
- if manifest["packages"].empty?
345
+ if manifest[@packages_folder].empty?
332
346
  say(" - none")
333
347
  end
334
348
 
335
- for package in manifest["packages"]
349
+ for package in manifest[@packages_folder]
336
350
  say(" - #{package["name"]} (#{package["version"]})")
337
351
  end
338
352
 
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Cli
3
- VERSION = '1.3016.0'
3
+ VERSION = '1.3022.0'
4
4
  end
5
5
  end
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.3016.0
4
+ version: 1.3022.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-23 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.3016.0
19
+ version: 1.3022.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.3016.0
26
+ version: 1.3022.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.3016.0
33
+ version: 1.3022.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.3016.0
40
+ version: 1.3022.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.3016.0
131
+ version: 1.3022.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.3016.0
138
+ version: 1.3022.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: net-ssh
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -306,7 +306,7 @@ dependencies:
306
306
  version: '0'
307
307
  description: |-
308
308
  BOSH CLI
309
- 10557b
309
+ 6073a7
310
310
  email: support@cloudfoundry.com
311
311
  executables:
312
312
  - bosh