Replace resolv.conf if nameserver is 127.0.0.1

Debian OpenStack images has resolv.conf with "nameserver 127.0.0.1". If not overwritten minion seeding will fail (after a long period of time - network timeout) as no name lookups can be made.
Upon VM boot DHCP settings will overwrite resolv.conf again.
This commit is contained in:
Kenn Leth Hansen 2018-01-09 12:19:42 +01:00 committed by Kenn Leth Hansen
parent 9cb6ac3be0
commit ae1359eb14

View File

@ -278,6 +278,8 @@ def _check_resolv(mpt):
conts = fp_.read()
if 'nameserver' not in conts:
replace = True
if 'nameserver 127.0.0.1' in conts:
replace = True
if replace:
shutil.copy('/etc/resolv.conf', resolv)