[numeros_disponibles] On ajoute une option à la ligne de commande pour ne pas utiliser dialog
This commit is contained in:
parent
9c7cbce83e
commit
71858b175b
1 changed files with 13 additions and 6 deletions
|
@ -8,7 +8,7 @@ Copyright (C) Alexandre Bos, largement pompe sur ldap_crans.py
|
|||
Licence : GPLv2
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
from config import NETs
|
||||
from iptools import AddrInNet
|
||||
try:
|
||||
|
@ -79,13 +79,20 @@ def update_ip_wifi_adh(occupees):
|
|||
update_ip('wifi-adh','ip_wifi-adh', occupees)
|
||||
|
||||
if __name__ == "__main__":
|
||||
dlg = Dialog()
|
||||
dlg.gauge_start(text="Recherche des machines...", backtitle="numeros_disponibles")
|
||||
if "--cron" in sys.argv:
|
||||
cron = True
|
||||
else:
|
||||
cron = False
|
||||
if not cron:
|
||||
dlg = Dialog()
|
||||
dlg.gauge_start(text="Recherche des machines...", backtitle="numeros_disponibles")
|
||||
ip_occupees = lister_ip_utilisees()
|
||||
done = 1
|
||||
for net in NETs.keys():
|
||||
dlg.gauge_update(int(done*100/(len(NETs)+1)), text="IP libres dans %s" % net, update_text=True)
|
||||
if not cron:
|
||||
dlg.gauge_update(int(done*100/(len(NETs)+1)), text="IP libres dans %s" % net, update_text=True)
|
||||
update_ip(net, ip_occupees)
|
||||
done += 1
|
||||
dlg.gauge_update(100, text="Fini !", update_text=True)
|
||||
dlg.gauge_stop()
|
||||
if not cron:
|
||||
dlg.gauge_update(100, text="Fini !", update_text=True)
|
||||
dlg.gauge_stop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue