s4:python/samba/join.py: add optional 'machinepass' parameter to class dc_join
authorStefan Metzmacher <metze@samba.org>
Mon, 28 Nov 2011 19:03:11 +0000 (20:03 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 29 Nov 2011 08:21:25 +0000 (09:21 +0100)
metze

source4/scripting/python/samba/join.py

index 3f1abe22ebd501e9afee0affaa019b209ec154ac..bd91e6269e60ebc2fe2d26f690d488bca7439296 100644 (file)
@@ -48,7 +48,8 @@ class dc_join(object):
     '''perform a DC join'''
 
     def __init__(ctx, server=None, creds=None, lp=None, site=None,
-            netbios_name=None, targetdir=None, domain=None):
+            netbios_name=None, targetdir=None, domain=None,
+            machinepass=None):
         ctx.creds = creds
         ctx.lp = lp
         ctx.site = site
@@ -90,7 +91,10 @@ class dc_join(object):
         ctx.dc_dnsHostName = ctx.get_dnsHostName()
         ctx.behavior_version = ctx.get_behavior_version()
 
-        ctx.acct_pass = samba.generate_random_password(32, 40)
+        if machinepass is not None:
+            ctx.acct_pass = machinepass
+        else:
+            ctx.acct_pass = samba.generate_random_password(32, 40)
 
         # work out the DNs of all the objects we will be adding
         ctx.server_dn = "CN=%s,CN=Servers,CN=%s,CN=Sites,%s" % (ctx.myname, ctx.site, ctx.config_dn)