En fait, cela marche, j'avais pas vu le .encode tratre la fin...
darcs-hash:20051011104526-d1718-0a4fc6accad5f803001fd0b22361c7ddfde83466.gz
This commit is contained in:
parent
a4b3685c8d
commit
fcbf4c4755
1 changed files with 6 additions and 6 deletions
|
@ -20,10 +20,10 @@ def execute(macro, text) :
|
|||
status = getstatusoutput('grep -v " 0 " /etc/autostatus/local.status')
|
||||
|
||||
if status[0] and status[0] != 256 :
|
||||
return Cellule(u'Impossible d\'analyser le fichier de status.'.encode('utf-8'),'yellow',macro.formatter)
|
||||
return Cellule(u'Impossible d\'analyser le fichier de status.','yellow',macro.formatter)
|
||||
|
||||
if not status[1].strip() :
|
||||
return Cellule(u'Toutes les machines importantes sont up.'.encode('utf-8'),'lime',macro.formatter)
|
||||
return Cellule(u'Toutes les machines importantes sont up.','lime',macro.formatter)
|
||||
|
||||
lines = status[1].split('\n')
|
||||
|
||||
|
@ -35,18 +35,18 @@ def execute(macro, text) :
|
|||
line = line.split(' ')
|
||||
code += f.table_row(1)
|
||||
code += f.table_cell(1,{'style':'background-color:silver'})
|
||||
code += f.text('%s (%s)' % (line [0], getoutput("grep '%s' /etc/autostatus/hosts | cut -d ' ' -f 5-" % line [0])) )
|
||||
code += f.text('%s (%s)' % (line [0], getoutput("grep '^%s' /etc/autostatus/hosts | cut -d ' ' -f 5-" % line [0])) )
|
||||
code += f.table_cell(0)
|
||||
# nombre de non réponse au ping
|
||||
if int(line[1]) > 2 :
|
||||
code += f.table_cell(1,{'style':'background-color:red'})
|
||||
code += f.text(u'down'.encode('utf-8'))
|
||||
code += f.text(u'down')
|
||||
else :
|
||||
code += f.table_cell(1,{'style':'background-color:blue'})
|
||||
code += f.text(u'etat incertain'.encode('utf-8'))
|
||||
code += f.text(u'état incertain')
|
||||
code += f.table_cell(0)
|
||||
code += f.table_row(0)
|
||||
|
||||
code += f.table(0)
|
||||
|
||||
return code.encode('iso-8859-15')
|
||||
return code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue