1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

don't raise exceptoins on bad hosts files

fixes #14969
This commit is contained in:
Brian Coca 2016-03-14 20:13:23 -07:00
parent 051b9e7b90
commit f3b9449e07

View file

@ -770,7 +770,8 @@ class Facts(object):
for nameserver in tokens[1:]: for nameserver in tokens[1:]:
self.facts['dns']['nameservers'].append(nameserver) self.facts['dns']['nameservers'].append(nameserver)
elif tokens[0] == 'domain': elif tokens[0] == 'domain':
self.facts['dns']['domain'] = tokens[1] if len(tokens) > 1:
self.facts['dns']['domain'] = tokens[1]
elif tokens[0] == 'search': elif tokens[0] == 'search':
self.facts['dns']['search'] = [] self.facts['dns']['search'] = []
for suffix in tokens[1:]: for suffix in tokens[1:]:
@ -781,12 +782,13 @@ class Facts(object):
self.facts['dns']['sortlist'].append(address) self.facts['dns']['sortlist'].append(address)
elif tokens[0] == 'options': elif tokens[0] == 'options':
self.facts['dns']['options'] = {} self.facts['dns']['options'] = {}
for option in tokens[1:]: if len(tokens) > 1:
option_tokens = option.split(':', 1) for option in tokens[1:]:
if len(option_tokens) == 0: option_tokens = option.split(':', 1)
continue if len(option_tokens) == 0:
val = len(option_tokens) == 2 and option_tokens[1] or True continue
self.facts['dns']['options'][option_tokens[0]] = val val = len(option_tokens) == 2 and option_tokens[1] or True
self.facts['dns']['options'][option_tokens[0]] = val
def _get_mount_size_facts(self, mountpoint): def _get_mount_size_facts(self, mountpoint):
size_total = None size_total = None