Sha256: 596f9189fffd9d4880c772ca99bd8626ba2f1e48b29a5712766e8f63a975a627
Contents?: true
Size: 1.22 KB
Versions: 23
Compression:
Stored size: 1.22 KB
Contents
# rubocop:disable Lint/RescueWithoutErrorClass module Fog module Vsphere class Compute class Real def list_vm_cdroms(vm_id) get_vm_ref(vm_id).config.hardware.device.select { |hw| hw.class == RbVmomi::VIM::VirtualCdrom }.map do |cdrom| { filename: (begin cdrom.backing.fileName rescue (nil) end), name: cdrom.deviceInfo.label, key: cdrom.key, controller_key: cdrom.controllerKey, unit_number: cdrom.unitNumber, start_connected: cdrom.connectable.startConnected, allow_guest_control: cdrom.connectable.allowGuestControl, connected: cdrom.connectable.connected, instance_uuid: vm_id } end end end class Mock def list_vm_cdroms(vm_id) raise Fog::Vsphere::Compute::NotFound, 'VM not Found' unless data[:servers].key?(vm_id) return [] unless data[:servers][vm_id].key?('cdroms') data[:servers][vm_id]['cdroms'].map { |h| h.merge(instance_uuid: vm_id) } end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems