Possibilit d'ajouter un item la liste des services redmarrer.

darcs-hash:20041214132631-41617-f9ee679921b08032ac69479c0f778bf6221c9984.gz
This commit is contained in:
pauget 2004-12-14 14:26:31 +01:00
parent b18d0af721
commit ba54ae5d97

View file

@ -23,7 +23,7 @@ from affich_tools import anim, cprint, OK, ERREUR, WARNING
from time import localtime, strftime, time
import config
args_autorises = ['quiet', 'remove=', 'list' ,'help', 'reconnect']
args_autorises = ['quiet', 'remove=', 'add=', 'list' ,'help', 'reconnect']
if hostname == 'zamok' :
args_autorises += [ 'home=', 'mail_bienvenue=', 'ML-ENS=', 'droits', 'switch=' , 'dhcp', 'dns', 'firewall' , 'del_user=', 'blacklist_upload', 'autostatus']
elif hostname == 'nectaris' :
@ -59,11 +59,13 @@ to_do = {}
for opt, val in options :
if opt == '--quiet' :
debug = 0
elif opt == '--remove' :
for serv in val.split('&') :
print 'Supression de %s' % serv
db.services_to_restart('-%s' % serv)
sys.exit(0)
elif opt == '--list' :
print 'Services à redémarrer :'
print db.services_to_restart()
@ -84,10 +86,24 @@ for opt, val in options :
print "Ajout de blacklist_%s pour reconfiguration" % s
db.services_to_restart('blacklist_%s' % s.encode())
sys.exit(0)
elif opt=='--add' :
# Ajout d'un item dans les services à redémarrer
for serv in val.split('&') :
if serv.find(',')!=-1 :
serv, arg = serv.split(',',1)
arg = arg.split(',')
else :
arg = []
print 'Ajout de %s (%s)' % ( serv, arg )
db.services_to_restart(serv, arg)
sys.exit(0)
elif opt =='-h' or opt == '--help' :
print __doc__ % { 'prog' : sys.argv[0].split('/')[-1] , 'options' : '\n\t'.join(args_autorises) }
sys.exit(0)
elif len(opt)>2 and opt[:2]=='--' :
to_do[opt[2:]] = val.split('&')