summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-07-11 11:09:00 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-11 14:32:44 +1000
commitfaec2588f51e97e7421b9b092e53d88c88f6abd9 (patch)
tree9fa173fe24ce59764d8925dc0573329e8f047fdd /source4
parent059941b6e76589d76773b66643b2ec6826a17800 (diff)
downloadsamba-faec2588f51e97e7421b9b092e53d88c88f6abd9.tar.gz
samba-faec2588f51e97e7421b9b092e53d88c88f6abd9.tar.bz2
samba-faec2588f51e97e7421b9b092e53d88c88f6abd9.zip
dbcheck: added confirm_all support for remaining checks
this allows the user to choose all/none for all the remaining database checks Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/dbchecker.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/dbchecker.py b/source4/scripting/python/samba/dbchecker.py
index 4209a3b78c..df9e9d75c1 100644
--- a/source4/scripting/python/samba/dbchecker.py
+++ b/source4/scripting/python/samba/dbchecker.py
@@ -58,6 +58,11 @@ class dbcheck(object):
self.yes = yes
self.quiet = quiet
self.remove_all_unknown_attributes = False
+ self.remove_all_empty_attributes = False
+ self.fix_all_normalisation = False
+ self.fix_all_DN_GUIDs = False
+ self.remove_all_deleted_DN_links = False
+ self.fix_all_target_mismatch = False
def check_database(self, DN=None, scope=ldb.SCOPE_SUBTREE, controls=[], attrs=['*']):
'''perform a database check, returning the number of errors found'''
@@ -121,7 +126,7 @@ class dbcheck(object):
def err_empty_attribute(self, dn, attrname):
'''fix empty attributes'''
self.report("ERROR: Empty attribute %s in %s" % (attrname, dn))
- if not self.confirm('Remove empty attribute %s from %s?' % (attrname, dn)):
+ if not self.confirm_all('Remove empty attribute %s from %s?' % (attrname, dn), 'remove_all_empty_attributes'):
self.report("Not fixing empty attribute %s" % attrname)
return
@@ -152,7 +157,7 @@ class dbcheck(object):
elif (normalised[0] != val):
self.report("value '%s' should be '%s'" % (val, normalised[0]))
mod_list.append((val, normalised[0]))
- if not self.confirm('Fix normalisation for %s from %s?' % (attrname, dn)):
+ if not self.confirm_all('Fix normalisation for %s from %s?' % (attrname, dn), 'fix_all_normalisation'):
self.report("Not fixing attribute %s" % attrname)
return
@@ -193,7 +198,7 @@ class dbcheck(object):
return
dsdb_dn.dn = res[0].dn
- if not self.confirm('Change DN to %s?' % str(dsdb_dn)):
+ if not self.confirm_all('Change DN to %s?' % str(dsdb_dn), 'fix_all_DN_GUIDs'):
self.report("Not fixing %s" % errstr)
return
m = ldb.Message()
@@ -215,7 +220,7 @@ class dbcheck(object):
def err_deleted_dn(self, dn, attrname, val, dsdb_dn, correct_dn):
self.report("ERROR: target DN is deleted for %s in object %s - %s" % (attrname, dn, val))
self.report("Target GUID points at deleted DN %s" % correct_dn)
- if not self.confirm('Remove DN?'):
+ if not self.confirm_all('Remove DN?', 'remove_all_deleted_DN_links'):
self.report("Not removing")
return
m = ldb.Message()
@@ -237,7 +242,7 @@ class dbcheck(object):
self.report("ERROR: incorrect DN string component for %s in object %s - %s" % (attrname, dn, val))
dsdb_dn.dn = correct_dn
- if not self.confirm('Change DN to %s?' % str(dsdb_dn)):
+ if not self.confirm_all('Change DN to %s?' % str(dsdb_dn), 'fix_all_target_mismatch'):
self.report("Not fixing %s" % errstr)
return
m = ldb.Message()