bosh_agent 1.5.0.pre.1141 → 1.5.0.pre.1142

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.
@@ -35,7 +35,7 @@ module Bosh::Agent
35
35
  def initialize(args)
36
36
  bsc_provider = Bosh::Agent::Config.blobstore_provider
37
37
  bsc_options = Bosh::Agent::Config.blobstore_options
38
- @blobstore_client = Bosh::Blobstore::Client.create(bsc_provider, bsc_options)
38
+ @blobstore_client = Bosh::Blobstore::Client.safe_create(bsc_provider, bsc_options)
39
39
  @blobstore_id, @sha1, @package_name, @package_version, @dependencies = args
40
40
 
41
41
  @base_dir = Bosh::Agent::Config.base_dir
@@ -87,11 +87,9 @@ module Bosh::Agent
87
87
  def upload_tarball(path)
88
88
  bsc_options = Bosh::Agent::Config.blobstore_options
89
89
  bsc_provider = Bosh::Agent::Config.blobstore_provider
90
-
91
- blobstore = Bosh::Blobstore::Client.create(bsc_provider, bsc_options)
90
+ blobstore = Bosh::Blobstore::Client.safe_create(bsc_provider, bsc_options)
92
91
 
93
92
  logger.info("Uploading tarball to blobstore")
94
-
95
93
  blobstore_id = nil
96
94
 
97
95
  File.open(path) do |f|
@@ -16,37 +16,30 @@ module Bosh::Agent
16
16
  def unpack_blob(blobstore_id, sha1, install_path)
17
17
  bsc_options = Bosh::Agent::Config.blobstore_options
18
18
  bsc_provider = Bosh::Agent::Config.blobstore_provider
19
- blobstore_client = Bosh::Blobstore::Client.create(bsc_provider, bsc_options)
19
+ blobstore_client = Bosh::Blobstore::Client.safe_create(bsc_provider, bsc_options)
20
20
 
21
21
  data_tmp = File.join(base_dir, 'data', 'tmp')
22
22
  FileUtils.mkdir_p(data_tmp)
23
23
 
24
24
  begin
25
25
  tf = Tempfile.open(blobstore_id, data_tmp)
26
- logger.info("Retrieving blob: #{blobstore_id}")
27
26
 
28
- blobstore_client.get(blobstore_id, tf)
29
- logger.info("Done retrieving blob")
30
-
31
- tf.flush
32
- blob_data_file = tf.path
27
+ begin
28
+ logger.info("Retrieving blob '#{blobstore_id}'")
29
+ blobstore_client.get(blobstore_id, tf, sha1: sha1)
30
+ rescue Bosh::Blobstore::BlobstoreError => e
31
+ raise Bosh::Agent::MessageHandlerError.new(e.inspect)
32
+ end
33
33
 
34
- logger.info("creating #{install_path}")
34
+ logger.info("Creating '#{install_path}'")
35
35
  FileUtils.mkdir_p(install_path)
36
36
 
37
- blob_sha1 = Digest::SHA1.file(blob_data_file).hexdigest
38
- logger.info("hexdigest of #{blob_data_file}")
39
-
40
- unless blob_sha1 == sha1
41
- raise Bosh::Agent::MessageHandlerError,
42
- "Expected sha1: #{sha1}, Downloaded sha1: #{blob_sha1}, Blobstore ID: #{blobstore_id}, Install Path: #{install_path}"
43
- end
44
-
45
- logger.info("Installing to: #{install_path}")
37
+ logger.info("Installing to '#{install_path}'")
46
38
  Dir.chdir(install_path) do
47
- output = `tar --no-same-owner -zxvf #{blob_data_file}`
48
- raise Bosh::Agent::MessageHandlerError.new(
49
- "Failed to unpack blob", output) unless $?.exitstatus == 0
39
+ output = `tar --no-same-owner -zxvf #{tf.path} 2>&1`
40
+ unless $?.exitstatus == 0
41
+ raise Bosh::Agent::MessageHandlerError.new("Failed to unpack blob", output)
42
+ end
50
43
  end
51
44
  rescue Exception => e
52
45
  logger.info("Failure unpacking blob: #{e.inspect} #{e.backtrace}")
@@ -57,7 +50,6 @@ module Bosh::Agent
57
50
  tf.unlink
58
51
  end
59
52
  end
60
-
61
53
  end
62
54
 
63
55
  # @param [Hash] Instance spec
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Bosh
4
4
  module Agent
5
- VERSION = '1.5.0.pre.1141'
5
+ VERSION = '1.5.0.pre.1142'
6
6
  BOSH_PROTOCOL = "1"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.1141
4
+ version: 1.5.0.pre.1142
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -162,7 +162,7 @@ dependencies:
162
162
  requirements:
163
163
  - - ~>
164
164
  - !ruby/object:Gem::Version
165
- version: 1.5.0.pre.1141
165
+ version: 1.5.0.pre.1142
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  requirements:
171
171
  - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: 1.5.0.pre.1141
173
+ version: 1.5.0.pre.1142
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: bosh_common
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,7 @@ dependencies:
178
178
  requirements:
179
179
  - - ~>
180
180
  - !ruby/object:Gem::Version
181
- version: 1.5.0.pre.1141
181
+ version: 1.5.0.pre.1142
182
182
  type: :runtime
183
183
  prerelease: false
184
184
  version_requirements: !ruby/object:Gem::Requirement
@@ -186,7 +186,7 @@ dependencies:
186
186
  requirements:
187
187
  - - ~>
188
188
  - !ruby/object:Gem::Version
189
- version: 1.5.0.pre.1141
189
+ version: 1.5.0.pre.1142
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: blobstore_client
192
192
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ dependencies:
194
194
  requirements:
195
195
  - - ~>
196
196
  - !ruby/object:Gem::Version
197
- version: 1.5.0.pre.1141
197
+ version: 1.5.0.pre.1142
198
198
  type: :runtime
199
199
  prerelease: false
200
200
  version_requirements: !ruby/object:Gem::Requirement
@@ -202,7 +202,7 @@ dependencies:
202
202
  requirements:
203
203
  - - ~>
204
204
  - !ruby/object:Gem::Version
205
- version: 1.5.0.pre.1141
205
+ version: 1.5.0.pre.1142
206
206
  - !ruby/object:Gem::Dependency
207
207
  name: rspec-fire
208
208
  requirement: !ruby/object:Gem::Requirement
@@ -222,7 +222,7 @@ dependencies:
222
222
  description: ! 'This agent listens for instructions from the bosh director on each
223
223
  server that bosh manages.
224
224
 
225
- 903d52'
225
+ 31eb14'
226
226
  email: support@cloudfoundry.com
227
227
  executables:
228
228
  - bosh_agent