Skip to content

Commit

Permalink
Fixed rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
kruge002 committed Feb 19, 2018
1 parent 5040e9f commit d618d2e
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def add_disk_config_spec(vmcs, options)
def add_network_adapter_config_spec(vmcs, options)
add_device_config_spec(vmcs, VirtualDeviceConfigSpecOperation::Add) do |vdcs|
vdcs.device = VimHash.new("VirtualVmxnet3") do |dev|
dev.key = get_next_device_idx # negative integer as temporary key
dev.key = next_device_idx # negative integer as temporary key
dev.unitNumber = 0
dev.addressType = "Generated"
dev.wakeOnLanEnabled = "true"
Expand All @@ -274,18 +274,18 @@ def add_network_adapter_config_spec(vmcs, options)
end
lan = Lan.find_by(:name => options[:network], :switch_id => HostSwitch.where(:host_id => host.id).pluck(:switch_id))
raise MiqException::MiqVmError, "Network [#{options[:network]}] is not available on target" if lan.nil?
if lan.switch.shared
dev.backing = VimHash.new("VirtualEthernetCardDistributedVirtualPortBackingInfo") do |bck|
bck.port = VimHash.new("DistributedVirtualSwitchPortConnection") do |pc|
pc.switchUuid = lan.switch.switch_uuid
pc.portgroupKey = lan.uid_ems
end
end
else
dev.backing = VimHash.new('VirtualEthernetCardNetworkBackingInfo') do |bck|
bck.deviceName = options[:network]
end
end
dev.backing = if lan.switch.shared
VimHash.new("VirtualEthernetCardDistributedVirtualPortBackingInfo") do |bck|
bck.port = VimHash.new("DistributedVirtualSwitchPortConnection") do |pc|
pc.switchUuid = lan.switch.switch_uuid
pc.portgroupKey = lan.uid_ems
end
end
else
VimHash.new('VirtualEthernetCardNetworkBackingInfo') do |bck|
bck.deviceName = options[:network]
end
end
end
end
end
Expand Down Expand Up @@ -371,7 +371,7 @@ def set_spec_option(obj, property, value, modifier = nil)
end
end

def get_next_device_idx
def next_device_idx
@new_device_idx ||= -100
@new_device_idx -= 1
end
Expand Down

0 comments on commit d618d2e

Please sign in to comment.