From ab2ca8022e4bd89e87e0b7ce908022e6df350866 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 25 Jan 2011 18:46:26 +0100 Subject: Fix assorted bugs found by pylint --- ipaserver/install/certs.py | 2 +- ipaserver/install/installutils.py | 4 ++-- ipaserver/ipaldap.py | 2 -- ipaserver/plugins/dogtag.py | 4 +--- ipaserver/plugins/ldap2.py | 2 +- ipaserver/plugins/ldapapi.py | 6 ------ ipaserver/servercore.py | 8 -------- 7 files changed, 5 insertions(+), 23 deletions(-) (limited to 'ipaserver') diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py index 209ed3e1c..da89370af 100644 --- a/ipaserver/install/certs.py +++ b/ipaserver/install/certs.py @@ -602,7 +602,7 @@ class CertDB(object): dogtag.https_request(self.host_name, api.env.ca_ee_port, "/ca/ee/ca/profileSubmitSSLClient", self.secdir, password, "ipaCert", **params) if http_status != 200: - raise CertificateOperationError(error=_('Unable to communicate with CMS (%s)') % \ + raise CertificateOperationError(error='Unable to communicate with CMS (%s)' % \ http_reason_phrase) # The result is an XML blob. Pull the certificate out of that diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index a5457e2dd..05d397eea 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -82,7 +82,7 @@ def verify_dns_records(host_name, responses, resaddr, family): rs = dnsclient.query(dns_addr.reverse_dns, dnsclient.DNS_C_IN, dnsclient.DNS_T_PTR) if len(rs) == 0: - raise RuntimeError("Cannot find Reverse Address for %s (%s)" % (host_name, addr)) + raise RuntimeError("Cannot find Reverse Address for %s (%s)" % (host_name, dns_addr.format())) rev = None for rsn in rs: @@ -91,7 +91,7 @@ def verify_dns_records(host_name, responses, resaddr, family): break if rev == None: - raise RuntimeError("Cannot find Reverse Address for %s (%s)" % (host_name, addr)) + raise RuntimeError("Cannot find Reverse Address for %s (%s)" % (host_name, dns_addr.format())) if rec.dns_name != rev.rdata.ptrdname: raise RuntimeError("The DNS forward record %s does not match the reverse address %s" % (rec.dns_name, rev.rdata.ptrdname)) diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py index b1f9f40c4..d2d3d98a7 100644 --- a/ipaserver/ipaldap.py +++ b/ipaserver/ipaldap.py @@ -611,8 +611,6 @@ class IPAdmin(SimpleLDAPObject): while not entry and int(time.time()) < timeout: try: entry = self.getEntry(dn, scope, filter, attrlist) - except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND): - pass # found entry, but no attr except ldap.NO_SUCH_OBJECT: pass # no entry yet except ldap.LDAPError, e: # badness diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index 45c3c1979..8563848bb 100644 --- a/ipaserver/plugins/dogtag.py +++ b/ipaserver/plugins/dogtag.py @@ -1519,9 +1519,7 @@ class ra(rabase.rabase): """ self.debug('%s.revoke_certificate()', self.fullname) if type(revocation_reason) is not int: - raise TYPE_ERROR('revocation_reason', int, revocation_reason, - type(revocation_reason) - ) + raise TypeError(TYPE_ERROR % ('revocation_reason', int, revocation_reason, type(revocation_reason))) # Convert serial number to integral type from string to properly handle # radix issues. Note: the int object constructor will properly handle large diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py index 86ea3f882..c920d21f9 100644 --- a/ipaserver/plugins/ldap2.py +++ b/ipaserver/plugins/ldap2.py @@ -308,7 +308,7 @@ class ldap2(CrudBackend, Encoder): _ldap.set_option(_ldap.OPT_X_TLS_KEYFILE, tls_keyfile) if debug_level: - _ldap.set_option(_ldap.OPT_X_DEBUG_LEVEL, debug_level) + _ldap.set_option(_ldap.OPT_DEBUG_LEVEL, debug_level) try: conn = _ldap.initialize(self.ldap_uri) diff --git a/ipaserver/plugins/ldapapi.py b/ipaserver/plugins/ldapapi.py index 847e2d2ba..1ef84579c 100644 --- a/ipaserver/plugins/ldapapi.py +++ b/ipaserver/plugins/ldapapi.py @@ -25,7 +25,6 @@ This wraps the python-ldap bindings. """ import ldap as _ldap -import ldap.dn from ipalib import api from ipalib import errors from ipalib.crud import CrudBackend @@ -443,9 +442,4 @@ class ldap(CrudBackend): return results - def get_effective_rights(self, dn, attrs=None): - binddn = self.find_entry_dn("krbprincipalname", self.conn.principal, "posixAccount") - - return servercore.get_effective_rights(binddn, dn, attrs) - api.register(ldap) diff --git a/ipaserver/servercore.py b/ipaserver/servercore.py index 38d42167b..66af11619 100644 --- a/ipaserver/servercore.py +++ b/ipaserver/servercore.py @@ -168,14 +168,6 @@ def get_entry_by_cn (cn, sattrs): searchfilter = "(cn=%s)" % cn return get_sub_entry("cn=accounts," + api.env.basedn, searchfilter, sattrs) -def get_user_by_uid(uid, sattrs): - """Get a specific user's entry.""" - # FIXME: should accept a container to look in -# uid = self.__safe_filter(uid) - searchfilter = "(&(uid=%s)(objectclass=posixAccount))" % uid - - return get_sub_entry("cn=accounts," + api.env.basedn, searchfilter, sattrs) - # User support def entry_exists(dn): -- cgit