From f9f261cb6090aa26357d4949008763b098122902 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Nov 2011 15:32:47 +0100 Subject: s4:python: add --machinepass option to 'samba-tool domain join' metze --- source4/scripting/python/samba/netcmd/domain.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source4') 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) -- cgit