Skip to content

Commit

Permalink
VMware: vmware_host_vmnic_facts: py3 fix (ansible#55117)
Browse files Browse the repository at this point in the history
With Python3, `filter()` returns an iterator. So we cannot do a `len()`
on the result.
  • Loading branch information
goneri authored and Akasurde committed Apr 11, 2019
1 parent b6bf910 commit f96c569
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ansible/modules/cloud/vmware/vmware_host_vmnic_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,10 @@ def gather_host_vmnic_facts(self):
host_vmnic_facts = dict(all=[], available=[], used=[], vswitch=dict(), dvswitch=dict())
host_nw_system = host.configManager.networkSystem
if host_nw_system:
vmnics = [pnic.device for pnic in nw_config.pnic if pnic.startswith('vmnic')]
nw_config = host_nw_system.networkConfig
host_vmnic_facts['all'] = [pnic.device for pnic in nw_config.pnic]
host_vmnic_facts['num_vmnics'] = (
len(filter(lambda s: s.startswith('vmnic'), [pnic.device for pnic in nw_config.pnic]))
)
host_vmnic_facts['num_vmnics'] = len(vmnics)
host_vmnic_facts['vmnic_details'] = []
for pnic in host.config.network.pnic:
pnic_facts = dict()
Expand Down

0 comments on commit f96c569

Please sign in to comment.