From: Matthieu Patou Date: Sun, 21 Feb 2010 18:28:35 +0000 (+0300) Subject: upgradeprovision: Allow script to be called with pydoc X-Git-Tag: samba-3.6.0pre1~4908 X-Git-Url: http://git.samba.org/samba.git/?p=kai%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=8f1f50daa5963d336f7505a2605e1008edf3ce29 upgradeprovision: Allow script to be called with pydoc Signed-off-by: Jelmer Vernooij --- diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision index 5fe71c4f040..3ce6ae422a5 100755 --- a/source4/scripting/bin/upgradeprovision +++ b/source4/scripting/bin/upgradeprovision @@ -722,43 +722,45 @@ def update_machine_account_password(paths, creds, session, names): def setup_path(file): return os.path.join(setup_dir, file) - -# From here start the big steps of the program -# First get files paths -paths=get_paths(param,smbconf=smbconf) -paths.setup = setup_dir -# Guess all the needed names (variables in fact) from the current -# provision. - -names = find_provision_key_parameters(param, creds, session, paths, smbconf) -if not sanitychecks(creds,session,names,paths): - message(SIMPLE,"Sanity checks for the upgrade fails, checks messages and correct it before rerunning upgradeprovision") - sys.exit(1) -# Let's see them -print_provision_key_parameters(names) -# With all this information let's create a fresh new provision used as reference -message(SIMPLE,"Creating a reference provision") -provisiondir = tempfile.mkdtemp(dir=paths.private_dir, prefix="referenceprovision") -newprovision(names, setup_dir, creds, session, smbconf, provisiondir, messageprovision) -# Get file paths of this new provision -newpaths = get_paths(param, targetdir=provisiondir) -populate_backlink(newpaths, creds, session,names.schemadn) -populate_dnsyntax(newpaths, creds, session,names.schemadn) -# Check the difference -update_basesamdb(newpaths, paths,names) - -if opts.full: - update_samdb(newpaths, paths, creds, session, names) -update_secrets(newpaths, paths, creds, session) -update_privilege(newpaths, paths) -update_machine_account_password(paths, creds, session, names) -# SD should be created with admin but as some previous acl were so wrong that admin can't modify them we have first -# to recreate them with the good form but with system account and then give the ownership to admin ... -admin_session_info = admin_session(lp, str(names.domainsid)) -message(SIMPLE,"Updating SD") -update_sd(paths, creds, session,names) -update_sd(paths, creds, admin_session_info, names) -check_updated_sd(newpaths, paths, creds, session, names) -message(SIMPLE,"Upgrade finished !") -# remove reference provision now that everything is done ! -rmall(provisiondir) +cmd = os.environ["_"] +m=re.match('(^|.*/)pydoc$',cmd) +if not m: + # From here start the big steps of the program + # First get files paths + paths=get_paths(param,smbconf=smbconf) + paths.setup = setup_dir + # Guess all the needed names (variables in fact) from the current + # provision. + + names = find_provision_key_parameters(param, creds, session, paths, smbconf) + if not sanitychecks(creds,session,names,paths): + message(SIMPLE,"Sanity checks for the upgrade fails, checks messages and correct it before rerunning upgradeprovision") + sys.exit(1) + # Let's see them + print_provision_key_parameters(names) + # With all this information let's create a fresh new provision used as reference + message(SIMPLE,"Creating a reference provision") + provisiondir = tempfile.mkdtemp(dir=paths.private_dir, prefix="referenceprovision") + newprovision(names, setup_dir, creds, session, smbconf, provisiondir, messageprovision) + # Get file paths of this new provision + newpaths = get_paths(param, targetdir=provisiondir) + populate_backlink(newpaths, creds, session,names.schemadn) + populate_dnsyntax(newpaths, creds, session,names.schemadn) + # Check the difference + update_basesamdb(newpaths, paths,names) + + if opts.full: + update_samdb(newpaths, paths, creds, session, names) + update_secrets(newpaths, paths, creds, session) + update_privilege(newpaths, paths) + update_machine_account_password(paths, creds, session, names) + # SD should be created with admin but as some previous acl were so wrong that admin can't modify them we have first + # to recreate them with the good form but with system account and then give the ownership to admin ... + admin_session_info = admin_session(lp, str(names.domainsid)) + message(SIMPLE,"Updating SD") + update_sd(paths, creds, session,names) + update_sd(paths, creds, admin_session_info, names) + check_updated_sd(newpaths, paths, creds, session, names) + message(SIMPLE,"Upgrade finished !") + # remove reference provision now that everything is done ! + rmall(provisiondir)