Passage à lc_ldap pour la liste des exemptés

This commit is contained in:
Gabriel Detraz 2015-08-17 12:47:28 +02:00
parent f8e7ffb3ed
commit 5f0247ffb3

View file

@ -1,23 +1,21 @@
#! /usr/bin/env python #!/bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys from lc_ldap import shortcuts
sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap, decode ldap = shortcuts.lc_ldap_readonly()
db = crans_ldap() machines = ldap.search(u"exempt=*")
machines = db.search('exempt=*')['machine']
txts = [] txts = []
for m in machines : for m in machines :
# texte pour la machine # texte pour la machine
txt = u'' txt = u''
txt += u'Propriétaire : %s\n' % m.proprietaire().Nom() txt += u'Propriétaire : %s\n' % m.proprio()
txt += u'Machine : %s\n' % m.nom() txt += u'Machine : %s\n' % m['host'][0]
txt += u'destination : %s\n' % ', '.join(m.exempt()) txt += u'destination : %s\n' % ', '.join([unicode(i) for i in m['exempt']])
txts.append(txt.strip()) txts.append(txt.strip())