Nettoie list_firewall.py, plus un oublie dans list_exempt

* output est une liste d'unicodes, mieux vaut .join() sur un unicode
This commit is contained in:
Pierre-Elliott Bécue 2015-08-18 03:58:18 +02:00
parent a5ddd73ce5
commit 94ee83b86a
2 changed files with 38 additions and 27 deletions

View file

@ -12,12 +12,12 @@ def make_output(ldap):
machines_avec_exemption = ldap.search(u"exempt=*")
output = []
for m in machines_avec_exemption:
for machine in machines_avec_exemption:
# texte pour la machine
txt = u''
txt += u'Propriétaire : %s\n' % m.proprio()
txt += u'Machine : %s\n' % m['host'][0]
txt += u'destination : %s\n' % ', '.join([unicode(i) for i in m['exempt']])
txt = u''
txt += u'Propriétaire : %s\n' % machine.proprio()
txt += u'Machine : %s\n' % machine['host'][0]
txt += u'destination : %s\n' % ', '.join([unicode(i) for i in machine['exempt']])
output.append(txt.strip())
return output
@ -26,4 +26,4 @@ if __name__ == '__main__':
LDAP = shortcuts.lc_ldap_readonly()
OUTPUT = make_output(LDAP)
print '\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(OUTPUT).encode(out_encoding)
print u'\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(OUTPUT).encode(out_encoding)