On stabilise le plugin Python en virant toute occurrence de print.
* Désolé. \o/
This commit is contained in:
parent
2c27a030ee
commit
4b36a51d99
102 changed files with 513 additions and 703 deletions
|
@ -12,21 +12,22 @@ include("ip")
|
|||
import config
|
||||
|
||||
if len(config.dhcp_servers) > 2:
|
||||
print "####################################################################"
|
||||
print "## ATTENTION LA CONFIGURATION NE PEUT PAS GÉRER PLUS DE DEUX DHCP ##"
|
||||
print "####################################################################"
|
||||
@"####################################################################"
|
||||
@"## ATTENTION LA CONFIGURATION NE PEUT PAS GÉRER PLUS DE DEUX DHCP ##"
|
||||
@"####################################################################"
|
||||
|
||||
myip = admip()
|
||||
herip = admipof([name for name in config.dhcp_servers if name != admhostname][0].split('.',1)[0])
|
||||
|
||||
print 'failover peer "dhcp-failover" {'
|
||||
@failover peer "dhcp-failover" {
|
||||
if has("dhcp-server-primary"):
|
||||
print """ primary;
|
||||
split 128;
|
||||
mclt 3600;"""
|
||||
@ primary;
|
||||
@ split 128;
|
||||
@ mclt 3600;
|
||||
elif has("dhcp-server-secondary"):
|
||||
print " secondary;"
|
||||
print """ address %s;
|
||||
@ secondary;
|
||||
|
||||
out(""" address %s;
|
||||
port 647;
|
||||
peer address %s;
|
||||
peer port 647;
|
||||
|
@ -34,4 +35,4 @@ print """ address %s;
|
|||
max-unacked-updates 10;
|
||||
load balance max seconds 3;
|
||||
}
|
||||
""" % (myip, herip)
|
||||
""" % (myip, herip))
|
||||
|
|
|
@ -13,51 +13,46 @@ import config.dns
|
|||
|
||||
instpar = has('ytrap-llatsni')
|
||||
|
||||
print """
|
||||
#
|
||||
# Sample configuration file for ISC dhcpd for Debian
|
||||
#
|
||||
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
|
||||
#
|
||||
|
||||
# The ddns-updates-style parameter controls whether or not the server will
|
||||
# attempt to do a DNS update when a lease is confirmed. We default to the
|
||||
# behavior of the version 2 packages ('none', since DHCP v2 didn't
|
||||
# have support for DDNS.)
|
||||
ddns-update-style none;"""
|
||||
|
||||
@#
|
||||
@# Sample configuration file for ISC dhcpd for Debian
|
||||
@#
|
||||
@# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
|
||||
@#
|
||||
@
|
||||
@# The ddns-updates-style parameter controls whether or not the server will
|
||||
@# attempt to do a DNS update when a lease is confirmed. We default to the
|
||||
@# behavior of the version 2 packages ('none', since DHCP v2 didn't
|
||||
@# have support for DDNS.)
|
||||
@ddns-update-style none;
|
||||
@
|
||||
if not instpar:
|
||||
print """
|
||||
include "/etc/dhcp3/omapi.conf";"""
|
||||
@include "/etc/dhcp3/omapi.conf";
|
||||
@
|
||||
|
||||
print """
|
||||
# option definitions common to all supported networks...
|
||||
option option-252 code 252 = text ;
|
||||
option domain-search code 119 = text ;
|
||||
option option-119 code 119 = text ;
|
||||
# La pluspart de nos réseaux sont taggués, on utilise donc une mtu de 1500-4 octets
|
||||
option interface-mtu 1496;
|
||||
|
||||
# If this DHCP server is the official DHCP server for the local
|
||||
# network, the authoritative directive should be uncommented.
|
||||
"""
|
||||
@# option definitions common to all supported networks...
|
||||
@option option-252 code 252 = text ;
|
||||
@option domain-search code 119 = text ;
|
||||
@option option-119 code 119 = text ;
|
||||
@# La pluspart de nos réseaux sont taggués, on utilise donc une mtu de 1500-4 octets
|
||||
@option interface-mtu 1496;
|
||||
@
|
||||
@# If this DHCP server is the official DHCP server for the local
|
||||
@# network, the authoritative directive should be uncommented.
|
||||
|
||||
if instpar:
|
||||
print "authoritative;"
|
||||
@authoritative;
|
||||
else:
|
||||
print "#authoritative;"
|
||||
@#authoritative;
|
||||
|
||||
print """
|
||||
# Use this to send dhcp log messages to a different log file (you also
|
||||
# have to hack syslog.conf to complete the redirection).
|
||||
log-facility local7;"""
|
||||
@# Use this to send dhcp log messages to a different log file (you also
|
||||
@# have to hack syslog.conf to complete the redirection).
|
||||
@log-facility local7;
|
||||
|
||||
if not instpar:
|
||||
print """
|
||||
include "/etc/dhcp3/dhcp-failover.conf";"""
|
||||
@include "/etc/dhcp3/dhcp-failover.conf";
|
||||
|
||||
if has("vlan-radin"):
|
||||
print """
|
||||
out("""
|
||||
# VLan gratuit
|
||||
subnet 10.42.0.0 netmask 255.255.0.0 {
|
||||
interface eth3;
|
||||
|
@ -68,10 +63,10 @@ subnet 10.42.0.0 netmask 255.255.0.0 {
|
|||
range 10.42.1.1 10.42.255.200;
|
||||
failover peer "dhcp-failover";
|
||||
}
|
||||
}""" % ', '.join(config.dns.recursiv['gratuit'])
|
||||
}""" % (', '.join(config.dns.recursiv['gratuit']),))
|
||||
|
||||
if has("vlan-accueil"):
|
||||
print """
|
||||
out("""
|
||||
# VLan accueil
|
||||
subnet 10.51.0.0 netmask 255.255.0.0 {
|
||||
interface eth4;
|
||||
|
@ -91,10 +86,10 @@ subnet 10.51.0.0 netmask 255.255.0.0 {
|
|||
failover peer "dhcp-failover";
|
||||
range 10.51.1.1 10.51.255.200;
|
||||
}
|
||||
}""" % ', '.join(config.dns.recursiv['accueil'])
|
||||
}""" % (', '.join(config.dns.recursiv['accueil']),))
|
||||
|
||||
if has("vlan-isolement"):
|
||||
print """
|
||||
out("""
|
||||
# VLan isolement
|
||||
subnet 10.52.0.0 netmask 255.255.0.0 {
|
||||
interface eth5;
|
||||
|
@ -111,10 +106,10 @@ subnet 10.52.0.0 netmask 255.255.0.0 {
|
|||
range 10.52.1.1 10.52.255.200;
|
||||
}
|
||||
}
|
||||
""" % ', '.join(config.dns.recursiv['isolement'])
|
||||
""" % (', '.join(config.dns.recursiv['isolement']),))
|
||||
|
||||
if not has("non-vlan-adherent") and not instpar:
|
||||
print """
|
||||
out("""
|
||||
# Vlan des adhérents
|
||||
subnet 138.231.136.0 netmask 255.255.248.0 {
|
||||
interface eth0;
|
||||
|
@ -137,10 +132,10 @@ subnet 138.231.136.0 netmask 255.255.248.0 {
|
|||
|
||||
include "/etc/dhcp3/generated/adherents.liste";
|
||||
}
|
||||
""" % ', '.join(config.dns.recursiv['fil'])
|
||||
""" % (', '.join(config.dns.recursiv['fil']),))
|
||||
|
||||
if has("vlan-wifi"):
|
||||
print """
|
||||
out("""
|
||||
# Vlan des wifi
|
||||
subnet 138.231.144.0 netmask 255.255.248.0 {
|
||||
interface eth2;
|
||||
|
@ -160,10 +155,10 @@ subnet 138.231.144.0 netmask 255.255.248.0 {
|
|||
deny unknown-clients;
|
||||
|
||||
include "/etc/dhcp3/generated/wifi.liste";
|
||||
}""" % ', '.join(config.dns.recursiv['wifi'])
|
||||
}""" % (', '.join(config.dns.recursiv['wifi']),))
|
||||
|
||||
if has("vlan-ens"):
|
||||
print """
|
||||
out("""
|
||||
#Vlan appartement
|
||||
subnet 10.2.9.0 netmask 255.255.255.0 {
|
||||
interface eth6;
|
||||
|
@ -181,10 +176,10 @@ subnet 10.2.9.0 netmask 255.255.255.0 {
|
|||
|
||||
include "/etc/dhcp3/generated/appartements.liste";
|
||||
}
|
||||
""" % ', '.join(config.dns.recursiv['personnel-ens'])
|
||||
""" % (', '.join(config.dns.recursiv['personnel-ens']),))
|
||||
|
||||
if has("vlan-evenementiel"):
|
||||
print """
|
||||
out("""
|
||||
subnet 10.231.137.0 netmask 255.255.255.0 {
|
||||
range 10.231.137.20 10.231.137.254;
|
||||
next-server 10.231.137.1;
|
||||
|
@ -197,10 +192,10 @@ subnet 10.231.137.0 netmask 255.255.255.0 {
|
|||
# Fichier a charger pour le boot par le reseau
|
||||
filename "pxelinux.0";
|
||||
}
|
||||
""" % ', '.join(config.dns.recursiv['evenementiel'])
|
||||
""" % (', '.join(config.dns.recursiv['evenementiel']),))
|
||||
|
||||
if has("vlan-federez"):
|
||||
print """
|
||||
out("""
|
||||
# Vlan wifi federez
|
||||
subnet 10.53.0.0 netmask 255.255.0.0 {
|
||||
interface eth7;
|
||||
|
@ -219,4 +214,4 @@ subnet 10.53.0.0 netmask 255.255.0.0 {
|
|||
# Fichier a charger pour le boot par le reseau
|
||||
filename "pxelinux.0";
|
||||
}
|
||||
""" % ', '.join(config.dns.recursiv['fil'])
|
||||
""" % (', '.join(config.dns.recursiv['fil']),))
|
||||
|
|
|
@ -20,7 +20,7 @@ if not dhcp.dhcp_omapi_keys.get(admhostname, False):
|
|||
f.close()
|
||||
reload(dhcp)
|
||||
|
||||
print """
|
||||
out("""
|
||||
omapi-port 9991;
|
||||
key omapi_key {
|
||||
algorithm HMAC-MD5;
|
||||
|
@ -28,4 +28,4 @@ key omapi_key {
|
|||
};
|
||||
|
||||
omapi-key omapi_key;
|
||||
""" % dhcp.dhcp_omapi_keys.get(admhostname, '')
|
||||
""" % (dhcp.dhcp_omapi_keys.get(admhostname, ''),))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue