From 5f0247ffb39c70764d7e9c23b5cd3178b6036c02 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Mon, 17 Aug 2015 12:47:28 +0200 Subject: [PATCH] =?UTF-8?q?Passage=20=C3=A0=20lc=5Fldap=20pour=20la=20list?= =?UTF-8?q?e=20des=20exempt=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/tools/list_exempt.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) 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())