Reconnexion automatique pour les gens blacklists.
darcs-hash:20041022135748-41617-82beaee5b102ea50927228860b5ad80a7e847b10.gz
This commit is contained in:
parent
3b965f95f4
commit
15be9cc6fb
1 changed files with 21 additions and 4 deletions
|
@ -20,12 +20,12 @@ sys.path.append('/usr/scripts/gestion')
|
||||||
from ldap_crans import crans_ldap, crans, smtpserv, hostname
|
from ldap_crans import crans_ldap, crans, smtpserv, hostname
|
||||||
from lock import *
|
from lock import *
|
||||||
from affich_tools import anim, cprint, OK, ERREUR, WARNING
|
from affich_tools import anim, cprint, OK, ERREUR, WARNING
|
||||||
from time import localtime, strftime
|
from time import localtime, strftime, time
|
||||||
import config
|
import config
|
||||||
|
|
||||||
args_autorises = ['quiet', 'remove=', 'list' ,'help']
|
args_autorises = ['quiet', 'remove=', 'list' ,'help', 'reconnect']
|
||||||
if hostname == 'zamok' :
|
if hostname == 'zamok' :
|
||||||
args_autorises += [ 'home=', 'mail_bienvenue=', 'ML-ENS=', 'droits', 'switch=' , 'dhcp', 'dns', 'firewall' , 'del_user=', 'blacklist_upload', 'autostatus' ]
|
args_autorises += [ 'home=', 'mail_bienvenue=', 'ML-ENS=', 'droits', 'switch=' , 'dhcp', 'dns', 'firewall' , 'del_user=', 'blacklist_upload', 'autostatus']
|
||||||
elif hostname == 'nectaris' :
|
elif hostname == 'nectaris' :
|
||||||
args_autorises += [ 'conf_wifi', 'bornes_wifi=' , 'droits-nectaris']
|
args_autorises += [ 'conf_wifi', 'bornes_wifi=' , 'droits-nectaris']
|
||||||
elif hostname == 'sila' :
|
elif hostname == 'sila' :
|
||||||
|
@ -66,6 +66,23 @@ for opt, val in options :
|
||||||
print 'Services à redémarrer :'
|
print 'Services à redémarrer :'
|
||||||
print db.services_to_restart()
|
print db.services_to_restart()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
elif opt == '--reconnect' :
|
||||||
|
# Personnes à reconnecter
|
||||||
|
print 'Recheche personnes en fin de sanction.'
|
||||||
|
hier = strftime('%d/%m/%Y %H:%M'.split()[0],localtime(time()-60*60*24))
|
||||||
|
c = db.search('blacklist=*,%s*' % hier)
|
||||||
|
services = []
|
||||||
|
for a_reco in c['adherent'] + c['machine'] + c['club'] :
|
||||||
|
for bl in a_reco.blacklist() :
|
||||||
|
fin, sanction = bl.split(',')[1:3]
|
||||||
|
if fin.split()[0] == hier and sanction not in services :
|
||||||
|
services.append(sanction)
|
||||||
|
for s in services :
|
||||||
|
print "Ajout de blacklist_%s pour reconfiguration" % s
|
||||||
|
db.services_to_restart('blacklist_%s' % s.encode())
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
elif opt =='-h' or opt == '--help' :
|
elif opt =='-h' or opt == '--help' :
|
||||||
print __doc__ % { 'prog' : sys.argv[0].split('/')[-1] , 'options' : '\n\t'.join(args_autorises) }
|
print __doc__ % { 'prog' : sys.argv[0].split('/')[-1] , 'options' : '\n\t'.join(args_autorises) }
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue