mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update win_dns_client.py
If there is no dns address setted in the windows client, the iface_config.DNSServerSearchOrder method will return None, therefore this module will generate TypeError, 'NoneType' object is not iterable.
This commit is contained in:
parent
4450432161
commit
1a45db0fb7
1 changed files with 4 additions and 1 deletions
|
@ -45,7 +45,10 @@ def get_dns_servers(interface='Local Area Connection'):
|
|||
for iface in c.Win32_NetworkAdapter(NetEnabled=True):
|
||||
if interface == iface.NetConnectionID:
|
||||
iface_config = c.Win32_NetworkAdapterConfiguration(Index=iface.Index).pop()
|
||||
return list(iface_config.DNSServerSearchOrder)
|
||||
+ try:
|
||||
+ return list(iface_config.DNSServerSearchOrder)
|
||||
+ except:
|
||||
+ return []
|
||||
log.debug('Interface "{0}" not found'.format(interface))
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue