From db4e96ba06fd4c3f9d6e43e14f0c5bd003b9b703 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 13 May 2015 15:36:09 +1200 Subject: [PATCH] KCC: use KccError, simplify logic in NTDSConn.commit_modified silence a pep8 thing. Signed-off-by: Douglas Bagnall Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett --- python/samba/kcc/kcc_utils.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index 684459b0335..ef328bd4729 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -1035,19 +1035,16 @@ class NTDSConnection(object): # First verify we have this entry to ensure nothing # is programatically amiss try: - #XXX msg is never used - msg = samdb.search(base=self.dnstr, scope=ldb.SCOPE_BASE) - found = True + # we don't use the search result, but it tests the status + # of self.dnstr in the database. + samdb.search(base=self.dnstr, scope=ldb.SCOPE_BASE) except ldb.LdbError, (enum, estr): if enum == ldb.ERR_NO_SUCH_OBJECT: - found = False - else: - raise Exception("Unable to search for (%s) - (%s)" % - (self.dnstr, estr)) - if not found: - raise Exception("nTDSConnection for (%s) doesn't exist!" % - self.dnstr) + raise KCCError("nTDSConnection for (%s) doesn't exist!" % + self.dnstr) + raise KccError("Unable to search for (%s) - (%s)" % + (self.dnstr, estr)) if self.enabled: enablestr = "TRUE"