From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 85C8E138ACE for ; Thu, 25 Dec 2014 20:43:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 06011E095E; Thu, 25 Dec 2014 20:43:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 26409E08C4 for ; Thu, 25 Dec 2014 20:43:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1C8EB340486 for ; Thu, 25 Dec 2014 20:43:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B8C47D5D1 for ; Thu, 25 Dec 2014 20:43:09 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1419534482.a57687cb1d083e056bfbefad55d69f5607bffd1c.dol-sen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys-ldap/gkeyldap/connect.py gkeys-ldap/gkeyldap/search.py X-VCS-Directories: gkeys-ldap/gkeyldap/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: a57687cb1d083e056bfbefad55d69f5607bffd1c X-VCS-Branch: master Date: Thu, 25 Dec 2014 20:43:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a3087468-748e-4511-b133-a0c54c0baa0c X-Archives-Hash: f8f60b9d17c6d5cec2c148b014119fb9 commit: a57687cb1d083e056bfbefad55d69f5607bffd1c Author: Brian Dolbec gentoo org> AuthorDate: Thu Dec 25 19:08:02 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 25 19:08:02 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=a57687cb gkeys-ldap: Pass in our logger to LdapConnect class --- gkeys-ldap/gkeyldap/connect.py | 18 +++++++++--------- gkeys-ldap/gkeyldap/search.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gkeys-ldap/gkeyldap/connect.py b/gkeys-ldap/gkeyldap/connect.py index 74e393c..6c80e4f 100644 --- a/gkeys-ldap/gkeyldap/connect.py +++ b/gkeys-ldap/gkeyldap/connect.py @@ -14,15 +14,15 @@ except ImportError: raise -from gkeys.log import logger from gkeyldap.config import default_server class LdapConnect(object): '''Class to connect on the configured LDAP server''' - def __init__(self, server=None): + def __init__(self, server=None, logger=None): self.server = server or default_server - logger.debug('LdapConnect: __init__; server...: %s' % self.server) + self.logger = logger + self.logger.debug('LdapConnect: __init__; server...: %s' % self.server) self.ldap_connection = None def connect(self, server=None, action='LDAP'): @@ -30,21 +30,21 @@ class LdapConnect(object): @param server: string URI path for the LDAP server ''' - logger.info("%s... Establishing connection" % action) + self.logger.info("%s... Establishing connection" % action) if server: self.server = server - logger.debug('LdapConnect: connect; new server: %s' % self.server) + self.logger.debug('LdapConnect: connect; new server: %s' % self.server) try: self.ldap_connection = ldap.initialize(self.server) self.ldap_connection.set_option(ldap.OPT_X_TLS_DEMAND, True) self.ldap_connection.start_tls_s() self.ldap_connection.simple_bind_s() except Exception as e: - logger.error( + self.logger.error( 'LdapConnect: connect; failed to connect to server: %s' % self.server) - logger.error("Exception was: %s" % str(e)) - logger.error("Aborting %s... Connection failed" % action) + self.logger.error("Exception was: %s" % str(e)) + self.logger.error("Aborting %s... Connection failed" % action) return False - logger.debug( + self.logger.debug( 'LdapConnect: connect; connection: %s' % self.ldap_connection) return self.ldap_connection diff --git a/gkeys-ldap/gkeyldap/search.py b/gkeys-ldap/gkeyldap/search.py index 708c2e2..1bce9e1 100644 --- a/gkeys-ldap/gkeyldap/search.py +++ b/gkeys-ldap/gkeyldap/search.py @@ -27,7 +27,7 @@ class LdapSearch(object): self.logger = logger self.logger.debug('LdapSearch: __init__; fields...: %s' % self.fields) self.logger.debug('LdapSearch: __init__; criteria.: %s' % self.criteria) - self.ldap_connection = LdapConnect().connect(action='Search') + self.ldap_connection = LdapConnect(logger=self.logger).connect(action='Search') self.status = True if not self.ldap_connection: self.status = False