[gen_confs/switchs.py] more opts

darcs-hash:20090302175301-bd074-b3c60d90f9fa8a7744991bae237d225ce13e313d.gz
This commit is contained in:
Antoine Durand-Gasselin 2009-03-02 18:53:01 +01:00
parent cfb77c932a
commit 26ded0cfa3

View file

@ -486,16 +486,16 @@ aaa port-access mac-based %(prise)s unauth-vid 1
fd.close() fd.close()
if __name__ == '__main__' : if __name__ == '__main__' :
opts, args = getopt.getopt(sys.argv[1:], 'hga', ['get-conf', 'help']) opts, args = getopt.getopt(sys.argv[1:], 'hga', ['get-conf', 'help', 'all'])
if '-h' in sys.argv or '--help' in sys.argv or len(sys.argv) == 1 : if '-h' in sys.argv or '--help' in sys.argv or len(sys.argv) == 1 :
print "%s [-g|--get-conf] <switch>" % sys.argv[0].split('/')[-1].split('.')[0] print "%s [-g|--get-conf] <switch>" % sys.argv[0].split('/')[-1].split('.')[0]
print "Génération du fichier de configuration des switchs donnés." print "Génération du fichier de configuration des switchs donnés."
sys.exit(255) sys.exit(255)
if sys.argv[1] == 'all' : if args[0] == 'all' or 'a' in opts or '--all' in opts :
switchs = tuple(all_switchs()) switchs = tuple(all_switchs())
else : else :
switchs = tuple(sys.argv[1:]) switchs = tuple(args)
sw = switch(switchs) sw = switch(switchs)
sw.debug = 1 sw.debug = 1
sw.reconfigure() sw.reconfigure()