[wifi/status.py] on peut préciser le fichier d'output
darcs-hash:20100524230646-bd074-f76fc5d753393c5fe4999ce2617a49188a98cf12.gz
This commit is contained in:
parent
207477d711
commit
d1480862b0
1 changed files with 13 additions and 4 deletions
|
@ -3,12 +3,16 @@
|
||||||
|
|
||||||
# Génération d'un fichier XML indiquant le status des bornes
|
# Génération d'un fichier XML indiquant le status des bornes
|
||||||
|
|
||||||
import sys
|
import sys, os, time, optparse
|
||||||
import os
|
|
||||||
import time
|
|
||||||
sys.path.append("/usr/scripts/gestion")
|
sys.path.append("/usr/scripts/gestion")
|
||||||
sys.path.append("/usr/scripts/wifi")
|
sys.path.append("/usr/scripts/wifi")
|
||||||
|
|
||||||
|
### parsing
|
||||||
|
parser = optparse.OptionParser(usage="usage: %prog [-o FILE]")
|
||||||
|
parser.add_option('-o', '--output', help=u"outputs to FILE",
|
||||||
|
metavar='FILE', dest="filename")
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
from bornes import bornes_canal, bornes_clients, bornes_uptime
|
from bornes import bornes_canal, bornes_clients, bornes_uptime
|
||||||
|
|
||||||
from ldap_crans import crans_ldap
|
from ldap_crans import crans_ldap
|
||||||
|
@ -88,4 +92,9 @@ for b in bornes:
|
||||||
|
|
||||||
xml_bornes.appendChild(xml_borne)
|
xml_bornes.appendChild(xml_borne)
|
||||||
|
|
||||||
print (status.toxml().encode("UTF-8"))
|
if options.filename:
|
||||||
|
f = open(options.filename, 'w')
|
||||||
|
f.write(status.toxml().encode("UTF-8"))
|
||||||
|
f.close()
|
||||||
|
else:
|
||||||
|
print (status.toxml().encode("UTF-8"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue