Changeset 773
- Timestamp:
- 09/04/08 12:49:15 (3 months ago)
- Location:
- ares/trunk
- Files:
-
- 2 modified
-
ares.py (modified) (2 diffs)
-
tests/TestAres.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ares/trunk/ares.py
r771 r773 53 53 self.hostname = _Hostname(self) 54 54 self.dnsmasq = _Dnsmasq(self) 55 self.hosts = _Hosts(self) 55 56 56 57 if __name__ == '__main__': … … 254 255 aug.move(key, cfg + '/conf-dir') 255 256 aug.set(cfg + '/conf-dir', '/etc/dnsmasq.d') 257 258 # 259 # Hosts 260 # 261 class _Hosts: 262 263 def __init__(self, ares): 264 self._ares = ares 265 self._cfg = '/files/etc/hosts' 266 267 def setup(self): 268 cfg = self._cfg 269 aug = self._ares.aug 270 ip = '.'.join(self._ares.net.split('.')[0:3]) + '.1' 271 key = cfg + '/1000' 272 for k in aug.match(cfg + '/*/ipaddr'): 273 if aug.get(k) == ip: 274 key = k.rstrip('/ipaddr') 275 aug.set(key + '/ipaddr', ip) 276 aug.set(key + '/canonical', 'ares') -
ares/trunk/tests/TestAres.py
r771 r773 19 19 ares.hostname.setup() 20 20 ares.dnsmasq.setup() 21 ares.hosts.setup() 21 22 ares.aug.save() 22 23
