fog-vsphere 3.7.0 → 3.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2d12d766e82a1faadbe212c6bd4b456f2f5d8b5020eea068e3baf03bfed784a
4
- data.tar.gz: 9c83dbf3aedac89dd590e6ca916aa88a66c8bf3fe3340e94c9e42de919c9cb98
3
+ metadata.gz: 924b9bbb6dc4715d151b6737ab5a7c29ba114e3c8f3e3d05366d29a5f164c52e
4
+ data.tar.gz: bca22014a94f40e12301c2f18664242effbd09c984cff91e134947f5a4e799c1
5
5
  SHA512:
6
- metadata.gz: a7c125bd12412bf05a7bb3941bf911f84b3fffd5a75e029b4af16173551c8059c1ac2325fc75eded98705f284a82116616473ff49c86f0b56eb98131a2ada32a
7
- data.tar.gz: 83783358165788fa50e94953c1946f0ab86abb3d0d93bbca2d91932abbb1be003e5b6ad2ba8f74aa2108bbbf23d8da70664c74cc06578c04b4351687b4fb3b22
6
+ metadata.gz: c7d777833b52e0184c94818bf6876ae3ee518425c57f9ae922b1f66b0f92b20c832e16e358d7e280c91ba2fa12f65c6469a231fe97ee55680c253541c09f817f
7
+ data.tar.gz: 5006c14b999ba3ee502a423a953407b1cbd5739f2de946adb67026dfadc08a937d7b770839d1110b5792b1a26e0eac8ba83a8f7f455bc8d51e86ec9390b7e6a9
@@ -347,7 +347,7 @@ module Fog
347
347
  end
348
348
 
349
349
  def is_uuid?(id)
350
- !(id =~ /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/).nil?
350
+ id.is_a?(String) && /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/.match?(id)
351
351
  end
352
352
  end
353
353
 
@@ -290,11 +290,11 @@ module Fog
290
290
  end
291
291
 
292
292
  def scsi_controllers
293
- attributes[:scsi_controllers] ||= service.list_vm_scsi_controllers(id)
293
+ attributes[:scsi_controllers] ||= id.nil? ? [] : service.list_vm_scsi_controllers(id)
294
294
  end
295
295
 
296
296
  def nvme_controllers
297
- attributes[:nvme_controllers] ||= service.list_vm_nvme_controllers(id)
297
+ attributes[:nvme_controllers] ||= id.nil? ? [] : service.list_vm_nvme_controllers(id)
298
298
  end
299
299
 
300
300
  def scsi_controller
@@ -136,7 +136,7 @@ module Fog
136
136
  def device_change(attributes)
137
137
  devices = []
138
138
  if (nics = attributes[:interfaces])
139
- devices << nics.map { |nic| create_interface(nic, nics.index(nic), :add, attributes) }
139
+ devices << nics.each_with_index.map { |nic, index| create_interface(nic, index, :add, attributes) }
140
140
  end
141
141
 
142
142
  if (scsi_controllers = attributes[:scsi_controllers] || attributes['scsi_controller'])
@@ -152,7 +152,7 @@ module Fog
152
152
  end
153
153
 
154
154
  if (cdroms = attributes[:cdroms])
155
- devices << cdroms.map { |cdrom| create_cdrom(cdrom, cdroms.index(cdrom)) }
155
+ devices << cdroms.each_with_index.map { |cdrom, index| create_cdrom(cdrom, index) }
156
156
  end
157
157
 
158
158
  devices << create_virtual_tpm if attributes[:virtual_tpm]
@@ -189,9 +189,9 @@ module Fog
189
189
  if nics = attributes[:interfaces]
190
190
  # key is based on 4000 + the interface index
191
191
  # we allow booting from all network interfaces, the first interface has the highest priority
192
- nics.each do |nic|
192
+ nics.each_with_index do |_nic, index|
193
193
  boot_order << RbVmomi::VIM::VirtualMachineBootOptionsBootableEthernetDevice.new(
194
- deviceKey: 4000 + nics.index(nic)
194
+ deviceKey: 4000 + index
195
195
  )
196
196
  end
197
197
  end
@@ -3,6 +3,8 @@ module Fog
3
3
  class Compute
4
4
  class Real
5
5
  def get_virtual_machine(id, datacenter_name = nil, folder = nil, recursive = false)
6
+ raise(Fog::Vsphere::Compute::NotFound, "The id of the virtual machine can't be nil") if id.nil?
7
+
6
8
  # The larger the VM list the longer it will take if not searching based on UUID.
7
9
  convert_vm_mob_ref_to_attr_hash(get_vm_ref(id, datacenter_name, folder, recursive))
8
10
  end
@@ -10,6 +12,8 @@ module Fog
10
12
  protected
11
13
 
12
14
  def get_vm_ref(id, dc = nil, folder = nil, recursive = false)
15
+ raise(Fog::Vsphere::Compute::NotFound, "The id of the virtual machine can't be nil") if id.nil?
16
+
13
17
  raw_datacenter = find_raw_datacenter(dc) if dc
14
18
  vm = case is_uuid?(id)
15
19
  # UUID based
@@ -173,6 +173,7 @@ module Fog
173
173
  device_change.concat(modify_template_volumes_specs(vm_mob_ref, options['volumes']))
174
174
  device_change.concat(add_new_volumes_specs(vm_mob_ref, options['volumes'])) unless options['storage_pod']
175
175
  end
176
+ device_change << create_virtual_tpm if options['virtual_tpm'].present?
176
177
  virtual_machine_config_spec.deviceChange = device_change if device_change.any?
177
178
  # Options['numCPUs'] or Options['memoryMB']
178
179
  # Build up the specification for Hardware, for more details see ____________
@@ -216,7 +217,7 @@ module Fog
216
217
  RbVmomi::VIM::VirtualMachineBootOptionsBootableFloppyDevice.new
217
218
  end
218
219
  end
219
- virtual_machine_config_spec.bootOptions = { bootOrder: boot_order }
220
+ virtual_machine_config_spec.bootOptions = { bootOrder: boot_order, efiSecureBootEnabled: options["secure_boot"] || false }
220
221
  end
221
222
  # Options['customization_spec']
222
223
  # OLD Options still supported
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Vsphere
3
- VERSION = '3.7.0'.freeze
3
+ VERSION = '3.7.2'.freeze
4
4
  end
5
5
  end