gestion: vieilleries
This commit is contained in:
parent
d5921db4c7
commit
113eb17c4d
4 changed files with 0 additions and 0 deletions
32
archive/gestion/liberation_ip.py
Normal file
32
archive/gestion/liberation_ip.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
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