[liberation_ip] script initial
Ignore-this: aa83ccb184cd5c32ce065346a10160d darcs-hash:20111106195832-3651d-99f66971094de19d552f8f470d9c99f4902dae0d.gz
This commit is contained in:
parent
8b91831247
commit
3ebd31cf70
1 changed files with 32 additions and 0 deletions
32
gestion/liberation_ip.py
Executable file
32
gestion/liberation_ip.py
Executable file
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
import config
|
||||
from ldap_crans import crans_ldap, decode
|
||||
db = crans_ldap()
|
||||
|
||||
annee = config.ann_scol
|
||||
|
||||
|
||||
#suppression des machines
|
||||
|
||||
adherents = db.search( 'paiement=%d&paiement!=%d' % (annee - 1, annee), 'w' )['adherent']
|
||||
for adherent in adherents:
|
||||
print "suppression des machines de: %(nom)s " % {'nom': adherent.Nom()}
|
||||
machines = adherent.machines()
|
||||
for machine in machines:
|
||||
print "suppression machine: %(nom)s " % {'nom': machine.nom()}
|
||||
machine.delete('liberation de l\'adresse')
|
||||
|
||||
# regeneration du pool d'ip
|
||||
|
||||
print "Regeneration du pool d'ip"
|
||||
import numeros_disponibles
|
||||
|
||||
ip_occupees = numeros_disponibles.lister_ip_utilisees()
|
||||
for net in config.NETs.keys():
|
||||
numeros_disponibles.update_ip(net, ip_occupees)
|
||||
print "Fini !"
|
Loading…
Add table
Add a link
Reference in a new issue