mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
VMware: vmware_host_vmnic_facts: py3 fix (#55117)
With Python3, `filter()` returns an iterator. So we cannot do a `len()` on the result.
This commit is contained in:
parent
b6bf910bf4
commit
f96c569f9d
1 changed files with 2 additions and 3 deletions
|
@ -192,11 +192,10 @@ class HostVmnicMgr(PyVmomi):
|
||||||
host_vmnic_facts = dict(all=[], available=[], used=[], vswitch=dict(), dvswitch=dict())
|
host_vmnic_facts = dict(all=[], available=[], used=[], vswitch=dict(), dvswitch=dict())
|
||||||
host_nw_system = host.configManager.networkSystem
|
host_nw_system = host.configManager.networkSystem
|
||||||
if host_nw_system:
|
if host_nw_system:
|
||||||
|
vmnics = [pnic.device for pnic in nw_config.pnic if pnic.startswith('vmnic')]
|
||||||
nw_config = host_nw_system.networkConfig
|
nw_config = host_nw_system.networkConfig
|
||||||
host_vmnic_facts['all'] = [pnic.device for pnic in nw_config.pnic]
|
host_vmnic_facts['all'] = [pnic.device for pnic in nw_config.pnic]
|
||||||
host_vmnic_facts['num_vmnics'] = (
|
host_vmnic_facts['num_vmnics'] = len(vmnics)
|
||||||
len(filter(lambda s: s.startswith('vmnic'), [pnic.device for pnic in nw_config.pnic]))
|
|
||||||
)
|
|
||||||
host_vmnic_facts['vmnic_details'] = []
|
host_vmnic_facts['vmnic_details'] = []
|
||||||
for pnic in host.config.network.pnic:
|
for pnic in host.config.network.pnic:
|
||||||
pnic_facts = dict()
|
pnic_facts = dict()
|
||||||
|
|
Loading…
Reference in a new issue