remove commented code and fixed formatting

This commit is contained in:
Davis Phillips 2016-11-09 11:06:03 -06:00 committed by Matt Clay
parent 995cc2cd2d
commit ebdd9cf1a5

View file

@ -724,13 +724,12 @@ class PyVmomiHelper(object):
int(self.params['hardware']['memory_mb'])
# lets try and assign a static ip addresss
if 'customize' in self.params:
if self.params['customize'] is True:
ip_settings = list()
if self.params['ips'] and self.params['network']:
for ip_string in self.params['ips']:
ip = IPAddress(self.params['ips'])
for network in self.params['networks']:
if ip in IPNetwork(network):
self.params['networks'][network]['ip'] = str(ip)
ipnet = IPNetwork(network)
@ -739,34 +738,28 @@ class PyVmomiHelper(object):
)
ip_settings.append(self.params['networks'][network])
network = get_obj(self.content, [vim.Network], ip_settings[0]['network'])
key = 0
network = get_obj(self.content, [vim.Network], ip_settings[key]['network'])
datacenter = get_obj(self.content, [vim.Datacenter], self.params['datacenter'])
# get the folder where VMs are kept for this datacenter
destfolder = datacenter.vmFolder
cluster = get_obj(self.content, [vim.ClusterComputeResource],self.params['cluster'])
devices = []
adaptermaps = []
try:
for device in template.config.hardware.device:
if hasattr(device, 'addressType'):
nic = vim.vm.device.VirtualDeviceSpec()
nic.operation = \
vim.vm.device.VirtualDeviceSpec.Operation.remove
nic.operation = vim.vm.device.VirtualDeviceSpec.Operation.remove
nic.device = device
devices.append(nic)
except:
pass
# for key, ip in enumerate(ip_settings):
# VM device
# single device support
key = 0
nic = vim.vm.device.VirtualDeviceSpec()
nic.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
nic.device = vim.vm.device.VirtualVmxnet3()
@ -785,6 +778,7 @@ class PyVmomiHelper(object):
nic.device.connectable.allowGuestControl = True
devices.append(nic)
# Update the spec with the added NIC
clonespec_kwargs['config'].deviceChange = devices
guest_map = vim.vm.customization.AdapterMapping()