bosh_vsphere_cpi 1.2768.0 → 1.2776.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: 8af66504112ec3911132c5d16d9e521f282e8feb
4
- data.tar.gz: afa5d54a1f25c92a84fca0cb983427e935beba97
3
+ metadata.gz: 31149e0ae258f1112289e338fdaed4637a168920
4
+ data.tar.gz: 7410b16578fcca107ebb6374697fc5b3d01034f4
5
5
  SHA512:
6
- metadata.gz: 3b623c4c71086d44a0f454a2cc0c96de4e495fec23eac2f3a281b5c6ca77ac9ff9791da44534f2e772d9e89e871e10aa856f609eca3222d73f454172011b94e7
7
- data.tar.gz: 60acb0eeb63e4ec6d36fefbc1202e36ecb0334142897bf1f9ffbf7dc59a9cc0d651c67980d6a21f5999271abef5a388ad50eed09eed52762b6a0403e79892a54
6
+ metadata.gz: 44d87afdd54b60a14d09bc135db33e1a0caf0f5622d7f6400c51bfb8c235d6b8c7817259a47fee2fe48572f55a5b7d44ff1d021b0914c125cd0d21e1570f29bf
7
+ data.tar.gz: dc03664c276795f8bbbeccea132edad2f6d41f9b2a4a36f77e288e886d6fe123541b7725726b6b39a18999e02c697c99cf86e7ff78aebcd917aff33fa7b9a8df
@@ -15,7 +15,10 @@ module VSphereCloud
15
15
  return unless env_iso_folder
16
16
 
17
17
  datastore_name = cdrom.backing.datastore.name
18
- env_path = env_iso_folder.match(/\[#{datastore_name}\] (.*)/)[1]
18
+ datastore_pattern = Regexp.escape(datastore_name)
19
+ result = env_iso_folder.match(/\[#{datastore_pattern}\] (.*)/)
20
+ raise Bosh::Clouds::CloudError.new('Could not find matching datastore name') unless result
21
+ env_path = result[1]
19
22
 
20
23
  contents = @file_provider.fetch_file(datacenter_name, datastore_name, "#{env_path}/env.json")
21
24
  raise Bosh::Clouds::CloudError.new('Unable to load env.json') unless contents
@@ -27,7 +30,7 @@ module VSphereCloud
27
30
  env_json = JSON.dump(env)
28
31
 
29
32
  disconnect_cdrom(vm)
30
- clean_up_old_env(vm)
33
+ clean_env(vm)
31
34
  @file_provider.upload_file(location[:datacenter], location[:datastore], "#{location[:vm]}/env.json", env_json)
32
35
  @file_provider.upload_file(location[:datacenter], location[:datastore], "#{location[:vm]}/env.iso", generate_env_iso(env_json))
33
36
 
@@ -42,6 +45,17 @@ module VSphereCloud
42
45
  File.dirname(cdrom_device.backing.file_name)
43
46
  end
44
47
 
48
+ def clean_env(vm)
49
+ cdrom = @client.get_cdrom_device(vm)
50
+ env_iso_folder = env_iso_folder(cdrom)
51
+ return unless env_iso_folder
52
+
53
+ datacenter = @client.find_parent(vm, Vim::Datacenter)
54
+
55
+ @client.delete_path(datacenter, File.join(env_iso_folder, 'env.json'))
56
+ @client.delete_path(datacenter, File.join(env_iso_folder, 'env.iso'))
57
+ end
58
+
45
59
  private
46
60
 
47
61
  def update_cdrom_env(vm, datastore, file_name)
@@ -84,17 +98,6 @@ module VSphereCloud
84
98
  end
85
99
  end
86
100
 
87
- def clean_up_old_env(vm)
88
- cdrom = @client.get_cdrom_device(vm)
89
- env_iso_folder = env_iso_folder(cdrom)
90
- return unless env_iso_folder
91
-
92
- datacenter = @client.find_parent(vm, Vim::Datacenter)
93
-
94
- @client.delete_path(datacenter, File.join(env_iso_folder, 'env.json'))
95
- @client.delete_path(datacenter, File.join(env_iso_folder, 'env.iso'))
96
- end
97
-
98
101
  def which(programs)
99
102
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
100
103
  programs.each do |bin|
@@ -82,10 +82,12 @@ module VSphereCloud
82
82
 
83
83
  def delete_path(datacenter, path)
84
84
  task = @service_content.file_manager.delete_file(path, datacenter)
85
- wait_for_task(task)
86
- rescue => e
87
- unless e.message =~ /File .* was not found/
88
- raise e
85
+ begin
86
+ wait_for_task(task)
87
+ rescue => e
88
+ unless e.message =~ /File .* was not found/
89
+ raise e
90
+ end
89
91
  end
90
92
  end
91
93
 
@@ -94,7 +96,15 @@ module VSphereCloud
94
96
  [".vmdk", "-flat.vmdk"].each do |extension|
95
97
  tasks << @service_content.file_manager.delete_file("#{path}#{extension}", datacenter)
96
98
  end
97
- tasks.each { |task| wait_for_task(task) }
99
+ tasks.each do |task|
100
+ begin
101
+ wait_for_task(task)
102
+ rescue => e
103
+ unless e.message =~ /File .* was not found/
104
+ raise e
105
+ end
106
+ end
107
+ end
98
108
  end
99
109
 
100
110
  def move_disk(source_datacenter, source_path, dest_datacenter, dest_path)
@@ -252,19 +252,14 @@ module VSphereCloud
252
252
  @logger.info("Detached #{persistent_disks.size} persistent disk(s)")
253
253
  end
254
254
 
255
- retry_block { client.delete_vm(vm) }
256
- @logger.info("Deleted vm: #{vm_cid}")
257
-
258
255
  # Delete env.iso and VM specific files managed by the director
259
256
  retry_block do
260
257
  cdrom = devices.find { |device| device.kind_of?(Vim::Vm::Device::VirtualCdrom) }
261
- if cdrom
262
- env_iso_folder = @agent_env.env_iso_folder(cdrom)
263
- if env_iso_folder
264
- client.delete_path(datacenter, env_iso_folder)
265
- end
266
- end
258
+ @agent_env.clean_env(vm) if cdrom
267
259
  end
260
+
261
+ retry_block { client.delete_vm(vm) }
262
+ @logger.info("Deleted vm: #{vm_cid}")
268
263
  end
269
264
  end
270
265
 
@@ -1,7 +1,7 @@
1
1
  module Bosh
2
2
  module Clouds
3
3
  class VSphere
4
- VERSION = '1.2768.0'
4
+ VERSION = '1.2776.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_vsphere_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2768.0
4
+ version: 1.2776.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-11-19 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.2768.0
19
+ version: 1.2776.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.2768.0
26
+ version: 1.2776.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bosh_cpi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2768.0
33
+ version: 1.2776.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.2768.0
40
+ version: 1.2776.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: membrane
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +152,7 @@ dependencies:
152
152
  version: 0.7.1
153
153
  description: |-
154
154
  BOSH VSphere CPI
155
- 2b24dc
155
+ 5aa001
156
156
  email: support@cloudfoundry.com
157
157
  executables:
158
158
  - vsphere_cpi