diff --git a/gestion/tools/list_exempt.py b/gestion/tools/list_exempt.py index 66ca99b9..c7411fa0 100755 --- a/gestion/tools/list_exempt.py +++ b/gestion/tools/list_exempt.py @@ -1,23 +1,21 @@ -#! /usr/bin/env python +#!/bin/bash /usr/scripts/python.sh # -*- coding: utf-8 -*- -import sys -sys.path.append('/usr/scripts/gestion') +from lc_ldap import shortcuts -from ldap_crans import crans_ldap, decode +ldap = shortcuts.lc_ldap_readonly() -db = crans_ldap() -machines = db.search('exempt=*')['machine'] +machines = ldap.search(u"exempt=*") txts = [] for m in machines : - + # texte pour la machine - txt = u'' - txt += u'PropriƩtaire : %s\n' % m.proprietaire().Nom() - txt += u'Machine : %s\n' % m.nom() - txt += u'destination : %s\n' % ', '.join(m.exempt()) + 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']]) txts.append(txt.strip())