diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index ac3edd53..d3f4d1bf 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -20,7 +20,7 @@ sys.path.append('/usr/scripts/gestion') from ldap_crans import crans_ldap, crans, smtpserv, hostname from lock import * from affich_tools import anim, cprint, OK, ERREUR, WARNING -from time import localtime, strftime, time +from time import localtime, strftime, time, sleep import config args_autorises = ['quiet', 'remove=', 'add=', 'list' ,'help', 'reconnect'] @@ -325,6 +325,13 @@ if hostname == 'zamok': elif hostname == 'nectaris': + restart_wifi_update = False + if 'conf_wifi' in to_do.keys() or 'bornes_wifi' in to_do.keys(): + # On arrete wifi-update + os.system("kill $(cat /var/run/wifi-update.pid)") + sleep(1) + restart_wifi_update = True + # On s'occupe de nectaris if 'conf_wifi' in to_do.keys(): if auto : db.services_to_restart('-conf_wifi') @@ -369,6 +376,9 @@ elif hostname == 'nectaris': if auto : db.services_to_restart('droits-nectaris') sys.stdout.write('Erreur dans la config des droits sur nectaris.\n') + if restart_wifi_update: + os.system("cd / ; systrace -d /etc/systrace/wifi-update -A /usr/local/bin/twistd --syslog -o -y /usr/scripts/gestion/wifi-update.py --pidfile=/var/run/wifi-update.pid") + elif hostname == 'sila' : if 'bl_carte_etudiant' in to_do.keys() : if auto : db.services_to_restart('-bl_carte_etudiant') diff --git a/gestion/gen_confs/wifi.py b/gestion/gen_confs/wifi.py index 28e2a9a9..a3eca9a4 100755 --- a/gestion/gen_confs/wifi.py +++ b/gestion/gen_confs/wifi.py @@ -99,12 +99,6 @@ Netmask= 0.0.0.0 def __init__(self) : self.db = crans_ldap() - # Pour eviter le probleme de lock... - os.system("kill $(cat /var/run/wifi-update.pid)") - time.sleep(1) - - def __del__(self): - os.system("cd / ; systrace -d /etc/systrace/wifi-update -A /usr/local/bin/twistd --syslog -o -y /usr/scripts/gestion/wifi-update.py --pidfile=/var/run/wifi-update.pid") def lockname(self): # On change le nom du lock pour avoir un nom unique pour tout ce qui @@ -195,12 +189,6 @@ class bornes_wifi(gen_config) : def __init__(self,bornes=[]) : self.db = crans_ldap() self.bornes = bornes - # Pour eviter le probleme de lock... - os.system("kill $(cat /var/run/wifi-update.pid)") - time.sleep(1) - - def __del__(self): - os.system("cd / ; systrace -d /etc/systrace/wifi-update -A /usr/local/bin/twistd --syslog -o -y /usr/scripts/gestion/wifi-update.py --pidfile=/var/run/wifi-update.pid") def _gen(self) : bornes = self.db.search('host=*.wifi.crans.org&puissance=*')['machine']