mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Fallback to the newer object type for dvswitch
This commit is contained in:
@@ -157,7 +157,13 @@ def find_datastore_by_name(content, datastore_name):
|
||||
|
||||
def find_dvs_by_name(content, switch_name):
|
||||
|
||||
vmware_distributed_switches = get_all_objs(content, [vim.dvs.VmwareDistributedVirtualSwitch])
|
||||
# https://github.com/vmware/govmomi/issues/879
|
||||
# https://github.com/ansible/ansible/pull/31798#issuecomment-336936222
|
||||
try:
|
||||
vmware_distributed_switches = get_all_objs(content, [vim.dvs.VmwareDistributedVirtualSwitch])
|
||||
except IndexError:
|
||||
vmware_distributed_switches = get_all_objs(content, [vim.DistributedVirtualSwitch])
|
||||
|
||||
for dvs in vmware_distributed_switches:
|
||||
if dvs.name == switch_name:
|
||||
return dvs
|
||||
|
||||
Reference in New Issue
Block a user