reverting changes from a0b4462a to avoid casting strings to ints (#40131)

This commit is contained in:
Deric Crago 2018-06-05 04:12:55 -04:00 committed by ansibot
parent fb61680ccd
commit 9387c75e29

View file

@ -1075,10 +1075,11 @@ class PyVmomiHelper(PyVmomi):
dvps = self.cache.get_all_objs(self.content, [vim.dvs.DistributedVirtualPortgroup]) dvps = self.cache.get_all_objs(self.content, [vim.dvs.DistributedVirtualPortgroup])
for dvp in dvps: for dvp in dvps:
if hasattr(dvp.config.defaultPortConfig, 'vlan') and \ if hasattr(dvp.config.defaultPortConfig, 'vlan') and \
dvp.config.defaultPortConfig.vlan.vlanId == int(network['vlan']): isinstance(dvp.config.defaultPortConfig.vlan.vlanId, int) and \
str(dvp.config.defaultPortConfig.vlan.vlanId) == network['vlan']:
network['name'] = dvp.config.name network['name'] = dvp.config.name
break break
if dvp.config.name == str(network['vlan']): if dvp.config.name == network['vlan']:
network['name'] = dvp.config.name network['name'] = dvp.config.name
break break
else: else: