"credopts": options.CredentialsOptionsDouble,
}
+ def process_yes(option, opt, value, parser):
+ assert value is None
+ done = 0
+ rargs = parser.rargs
+ if rargs:
+ arg = rargs[0]
+ if ((arg[:2] == "--" and len(arg) > 2) or
+ (arg[:1] == "-" and len(arg) > 1 and arg[1] != "-")):
+ setattr(parser.values, "yes", True)
+ else:
+ setattr(parser.values, "yes_rules", arg.split())
+ del rargs[0]
+ else:
+ setattr(parser.values, "yes", True)
+
takes_args = ["DN?"]
takes_options = [
help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
Option("--fix", dest="fix", default=False, action='store_true',
help='Fix any errors found'),
- Option("--yes", dest="yes", default=False, action='store_true',
+ Option("--yes", action='callback', callback=process_yes,
help="don't confirm changes, just do them all as a single transaction"),
Option("--cross-ncs", dest="cross_ncs", default=False, action='store_true',
help="cross naming context boundaries"),
cross_ncs=False, quiet=False,
scope="SUB", credopts=None, sambaopts=None, versionopts=None,
attrs=None, reindex=False, force_modules=False,
- reset_well_known_acls=False):
+ reset_well_known_acls=False, yes_rules=[]):
lp = sambaopts.get_loadparm()
fix=fix, yes=yes, quiet=quiet, in_transaction=started_transaction,
reset_well_known_acls=reset_well_known_acls)
+ for option in yes_rules:
+ if hasattr(chk, option):
+ setattr(chk, option, 'ALL')
+ else:
+ raise CommandError("Invalid fix rule %s" % option)
+
if reindex:
self.outf.write("Re-indexing...\n")
error_count = 0