Add search domain to dnsmasq.upstream

Change-Id: I4fdd03ae0785ed21e35923e9a686664febd88035
Closes-bug: #1286028
This commit is contained in:
Matthew Mosesohn 2014-03-06 14:05:39 +04:00
parent 7cc12c6df7
commit 3a0d188398

View File

@ -78,6 +78,7 @@ is accessible"}
self.fixEtcHosts()
def fixDnsmasqUpstream(self):
'''Called on init to apply default DNS settings.'''
#check upstream dns server
with open('/etc/dnsmasq.upstream', 'r') as f:
dnslines = f.readlines()
@ -94,7 +95,9 @@ is accessible"}
with open('/etc/dnsmasq.upstream', 'w') as f:
nameservers = self.defaults['DNS_UPSTREAM'][
'value'].replace(',', ' ')
f.write("nameserver %s\n" % nameservers)
f.write("search {0}\n".format(self.defaults['DNS_SEARCH']))
f.write("domain {0}\n".format(self.defaults['DNS_DOMAIN']))
f.write("nameserver {0}\n".format(nameservers))
f.close()
def fixEtcHosts(self):
@ -269,6 +272,8 @@ is accessible"}
#Write dnsmasq upstream server
with open('/etc/dnsmasq.upstream', 'w') as f:
nameservers = responses['DNS_UPSTREAM'].replace(',', ' ')
f.write("search %s\n" % responses['DNS_SEARCH'])
f.write("domain %s\n" % responses['DNS_DOMAIN'])
f.write("nameserver %s\n" % nameservers)
f.close()