Detabification
darcs-hash:20050421100719-d1718-6dc337636c37181ae4af40fb0fde44cc21b6a751.gz
This commit is contained in:
parent
e89706bfc3
commit
e236f41035
1 changed files with 18 additions and 18 deletions
|
@ -63,9 +63,9 @@ subnet %(network)s netmask %(netmask)s {
|
||||||
|
|
||||||
host_template="""
|
host_template="""
|
||||||
host %(nom)s {
|
host %(nom)s {
|
||||||
hardware ethernet %(mac)s;
|
hardware ethernet %(mac)s;
|
||||||
fixed-address %(ip)s;
|
fixed-address %(ip)s;
|
||||||
option host-name "%(nom)s";
|
option host-name "%(nom)s";
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -84,31 +84,31 @@ subnet %(network)s netmask %(netmask)s {
|
||||||
######################################FIN PARTIE DE CONFIGURATION
|
######################################FIN PARTIE DE CONFIGURATION
|
||||||
|
|
||||||
def __str__(self) :
|
def __str__(self) :
|
||||||
return 'dhcp'
|
return 'dhcp'
|
||||||
|
|
||||||
def _gen(self) :
|
def _gen(self) :
|
||||||
warnings =''
|
warnings =''
|
||||||
|
|
||||||
### Construction de la partie du fichier contenant les machines
|
### Construction de la partie du fichier contenant les machines
|
||||||
hosts={}
|
hosts={}
|
||||||
|
|
||||||
self.anim.iter=len(self.machines)
|
self.anim.iter=len(self.machines)
|
||||||
for machine in self.machines :
|
for machine in self.machines :
|
||||||
self.anim.cycle()
|
self.anim.cycle()
|
||||||
t = 0
|
t = 0
|
||||||
for net in self.reseaux.keys() :
|
for net in self.reseaux.keys() :
|
||||||
if AddrInNet(machine.ip(),net) :
|
if AddrInNet(machine.ip(),net) :
|
||||||
d = { 'nom' : machine.nom().split('.')[0] , 'mac' : machine.mac() , 'ip' : machine.ip() }
|
d = { 'nom' : machine.nom().split('.')[0] , 'mac' : machine.mac() , 'ip' : machine.ip() }
|
||||||
try : hosts[net] += self.host_template % d
|
try : hosts[net] += self.host_template % d
|
||||||
except : hosts[net] = self.host_template % d
|
except : hosts[net] = self.host_template % d
|
||||||
t = 1
|
t = 1
|
||||||
|
|
||||||
### Ecriture du fichier
|
### Ecriture du fichier
|
||||||
fd = self._open_conf(self.DHCPD_CONF,'#')
|
fd = self._open_conf(self.DHCPD_CONF,'#')
|
||||||
for net, options in self.reseaux.items() :
|
for net, options in self.reseaux.items() :
|
||||||
if not hosts.has_key(net) :
|
if not hosts.has_key(net) :
|
||||||
warnings += u'Réseau %s ignoré : aucune machine à servir\n' % net
|
warnings += u'Réseau %s ignoré : aucune machine à servir\n' % net
|
||||||
continue
|
continue
|
||||||
d = param(net)
|
d = param(net)
|
||||||
d['OPTIONS_RESEAU'] = options
|
d['OPTIONS_RESEAU'] = options
|
||||||
d['HOSTs'] = hosts[net]
|
d['HOSTs'] = hosts[net]
|
||||||
|
@ -117,4 +117,4 @@ subnet %(network)s netmask %(netmask)s {
|
||||||
|
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
return warnings
|
return warnings
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue