summaryrefslogtreecommitdiff
path: root/source4/scripting/bin
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-02-21 21:28:35 +0300
committerJelmer Vernooij <jelmer@samba.org>2010-03-01 03:20:36 +0100
commit8f1f50daa5963d336f7505a2605e1008edf3ce29 (patch)
treeb048b11117719b4c2f36b1496603b25e1b66f173 /source4/scripting/bin
parent2bc3631db8546a44fb2bb29db8e380ea15c6441a (diff)
downloadsamba-8f1f50daa5963d336f7505a2605e1008edf3ce29.tar.gz
samba-8f1f50daa5963d336f7505a2605e1008edf3ce29.tar.bz2
samba-8f1f50daa5963d336f7505a2605e1008edf3ce29.zip
upgradeprovision: Allow script to be called with pydoc
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/upgradeprovision82
1 files changed, 42 insertions, 40 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 5fe71c4f04..3ce6ae422a 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)