diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-11-16 15:32:47 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-11-29 09:21:25 +0100 |
commit | f9f261cb6090aa26357d4949008763b098122902 (patch) | |
tree | d6dcf509204995020370839687af73bd82086672 /source4/scripting/python | |
parent | 4edbc719e5aa63b617f170b51382592dd57aa7b7 (diff) | |
download | samba-f9f261cb6090aa26357d4949008763b098122902.tar.gz samba-f9f261cb6090aa26357d4949008763b098122902.tar.bz2 samba-f9f261cb6090aa26357d4949008763b098122902.zip |
s4:python: add --machinepass option to 'samba-tool domain join'
metze
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/netcmd/domain.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 88d0d70320..bd73b6cab1 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -115,13 +115,15 @@ class cmd_domain_join(Command): Option("--domain-critical-only", help="only replicate critical domain objects", action="store_true"), + Option("--machinepass", type=str, metavar="PASSWORD", + help="choose machine password (otherwise random)") ] takes_args = ["domain", "role?"] def run(self, domain, role=None, sambaopts=None, credopts=None, versionopts=None, server=None, site=None, targetdir=None, - domain_critical_only=False, parent_domain=None): + domain_critical_only=False, parent_domain=None, machinepass=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) net = Net(creds, lp, server=credopts.ipaddress) @@ -137,26 +139,30 @@ class cmd_domain_join(Command): if role is None or role == "MEMBER": (join_password, sid, domain_name) = net.join_member(domain, netbios_name, - LIBNET_JOIN_AUTOMATIC) + LIBNET_JOIN_AUTOMATIC, + machinepass=machinepass) self.outf.write("Joined domain %s (%s)\n" % (domain_name, sid)) return elif role == "DC": join_DC(server=server, creds=creds, lp=lp, domain=domain, site=site, netbios_name=netbios_name, targetdir=targetdir, - domain_critical_only=domain_critical_only) + domain_critical_only=domain_critical_only, + machinepass=machinepass) return elif role == "RODC": join_RODC(server=server, creds=creds, lp=lp, domain=domain, site=site, netbios_name=netbios_name, targetdir=targetdir, - domain_critical_only=domain_critical_only) + domain_critical_only=domain_critical_only, + machinepass=machinepass) return elif role == "SUBDOMAIN": netbios_domain = lp.get("workgroup") if parent_domain is None: parent_domain = ".".join(domain.split(".")[1:]) join_subdomain(server=server, creds=creds, lp=lp, dnsdomain=domain, parent_domain=parent_domain, - site=site, netbios_name=netbios_name, netbios_domain=netbios_domain, targetdir=targetdir) + site=site, netbios_name=netbios_name, netbios_domain=netbios_domain, targetdir=targetdir, + machinepass=machinepass) return else: raise CommandError("Invalid role '%s' (possible values: MEMBER, DC, RODC, SUBDOMAIN)" % role) |