From a0ff4c349c6b75f9e5fa6b4ad0e69a4aa8e471b0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 6 Feb 2012 16:33:38 +0100 Subject: Revert "samba-tool: moved takes_optiongroups definition to Command base class" This reverts commit f6fa8684896b8f3f9f8b7bd3742c99906973274c. This keeps the main command class fairly slim, and makes it a bit more obvious where the arguments to run() are coming from. Conflicts: source4/scripting/python/samba/netcmd/__init__.py source4/scripting/python/samba/netcmd/domain.py source4/scripting/python/samba/netcmd/gpo.py source4/scripting/python/samba/netcmd/newuser.py source4/scripting/python/samba/netcmd/testparm.py source4/scripting/python/samba/netcmd/user.py source4/scripting/python/samba/tests/samba_tool/__init__.py --- source4/scripting/python/samba/netcmd/__init__.py | 7 +--- source4/scripting/python/samba/netcmd/dbcheck.py | 7 +++- .../scripting/python/samba/netcmd/delegation.py | 31 +++++++++++++- source4/scripting/python/samba/netcmd/domain.py | 27 +++++++++++- source4/scripting/python/samba/netcmd/drs.py | 31 +++++++++++++- source4/scripting/python/samba/netcmd/dsacl.py | 7 +++- source4/scripting/python/samba/netcmd/fsmo.py | 7 +++- source4/scripting/python/samba/netcmd/gpo.py | 12 +++++- source4/scripting/python/samba/netcmd/group.py | 25 ++++++++++- source4/scripting/python/samba/netcmd/ldapcmp.py | 7 +++- source4/scripting/python/samba/netcmd/ntacl.py | 13 +++++- source4/scripting/python/samba/netcmd/rodc.py | 7 +++- source4/scripting/python/samba/netcmd/spn.py | 18 +++++++- source4/scripting/python/samba/netcmd/testparm.py | 6 ++- source4/scripting/python/samba/netcmd/time.py | 7 +++- source4/scripting/python/samba/netcmd/user.py | 48 +++++++++++++++++++--- source4/scripting/python/samba/netcmd/vampire.py | 7 +++- 17 files changed, 240 insertions(+), 27 deletions(-) diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py index 6d7ca43424..f0cf7809c2 100644 --- a/source4/scripting/python/samba/netcmd/__init__.py +++ b/source4/scripting/python/samba/netcmd/__init__.py @@ -3,7 +3,6 @@ # Unix SMB/CIFS implementation. # Copyright (C) Jelmer Vernooij 2009-2011 # Copyright (C) Theresa Halloran 2011 -# Copyright (C) Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -71,11 +70,7 @@ class Command(object): synopsis = None takes_args = [] takes_options = [] - takes_optiongroups = { - "sambaopts": options.SambaOptions, - "credopts": options.CredentialsOptions, - "versionopts": options.VersionOptions, - } + takes_optiongroups = {} def __init__(self, outf=sys.stdout, errf=sys.stderr): self.outf = outf diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py index 875b059506..72b2f9189a 100644 --- a/source4/scripting/python/samba/netcmd/dbcheck.py +++ b/source4/scripting/python/samba/netcmd/dbcheck.py @@ -3,7 +3,6 @@ # Samba4 AD database checker # # Copyright (C) Andrew Tridgell 2011 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,6 +34,12 @@ class cmd_dbcheck(Command): """check local AD database for errors""" synopsis = "%prog [] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptionsDouble, + } + takes_args = ["DN?"] takes_options = [ diff --git a/source4/scripting/python/samba/netcmd/delegation.py b/source4/scripting/python/samba/netcmd/delegation.py index 469579e58c..17901cd163 100644 --- a/source4/scripting/python/samba/netcmd/delegation.py +++ b/source4/scripting/python/samba/netcmd/delegation.py @@ -5,7 +5,6 @@ # Copyright Matthieu Patou mat@samba.org 2010 # Copyright Stefan Metzmacher metze@samba.org 2011 # Copyright Bjoern Baumbach bb@sernet.de 2011 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,6 +40,12 @@ class cmd_delegation_show(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["accountname"] def run(self, accountname, credopts=None, sambaopts=None, versionopts=None): @@ -80,6 +85,12 @@ class cmd_delegation_for_any_service(Command): synopsis = "%prog [(on|off)] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["accountname", "onoff"] def run(self, accountname, onoff, credopts=None, sambaopts=None, versionopts=None): @@ -116,6 +127,12 @@ class cmd_delegation_for_any_protocol(Command): synopsis = "%prog [(on|off)] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["accountname", "onoff"] def run(self, accountname, onoff, credopts=None, sambaopts=None, versionopts=None): @@ -152,6 +169,12 @@ class cmd_delegation_add_service(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["accountname", "principal"] def run(self, accountname, principal, credopts=None, sambaopts=None, versionopts=None): @@ -189,6 +212,12 @@ class cmd_delegation_del_service(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["accountname", "principal"] def run(self, accountname, principal, credopts=None, sambaopts=None, versionopts=None): diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 176c4612db..664db18f5b 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -76,6 +76,12 @@ class cmd_domain_export_keytab(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("--principal", help="extract only this principal", type=str), ] @@ -118,6 +124,12 @@ class cmd_domain_join(Command): synopsis = "%prog [DC|RODC|MEMBER|SUBDOMAIN] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("--server", help="DC to join", type=str), Option("--site", help="site to join", type=str), @@ -407,7 +419,7 @@ class cmd_domain_demote(Command): except ldb.LdbError, l: pass - print "Demote successfull" + self.outf.write("Demote successfull\n") @@ -416,6 +428,12 @@ class cmd_domain_level(Command): synopsis = "%prog (show|raise ) [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), @@ -609,7 +627,6 @@ class cmd_domain_level(Command): raise CommandError("invalid argument: '%s' (choose from 'show', 'raise')" % subcommand) - class cmd_domain_passwordsettings(Command): """Sets password settings @@ -619,6 +636,12 @@ class cmd_domain_passwordsettings(Command): synopsis = "%prog (show|set ) [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py index 0d93298e97..0b367e3cd1 100644 --- a/source4/scripting/python/samba/netcmd/drs.py +++ b/source4/scripting/python/samba/netcmd/drs.py @@ -3,7 +3,6 @@ # implement samba_tool drs commands # # Copyright Andrew Tridgell 2010 -# Copyright Giampaolo Lauria 2011 # # based on C implementation by Kamen Mazdrashki # @@ -87,6 +86,12 @@ class cmd_drs_showrepl(Command): synopsis = "%prog [] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_args = ["DC?"] def print_neighbour(self, n): @@ -192,6 +197,12 @@ class cmd_drs_kcc(Command): synopsis = "%prog [] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_args = ["DC?"] def run(self, DC=None, sambaopts=None, @@ -255,6 +266,12 @@ class cmd_drs_replicate(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_args = ["DEST_DC", "SOURCE_DC", "NC"] takes_options = [ @@ -325,6 +342,12 @@ class cmd_drs_bind(Command): synopsis = "%prog [] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_args = ["DC?"] def run(self, DC=None, sambaopts=None, @@ -418,6 +441,12 @@ class cmd_drs_options(Command): synopsis = "%prog [] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_args = ["DC?"] takes_options = [ diff --git a/source4/scripting/python/samba/netcmd/dsacl.py b/source4/scripting/python/samba/netcmd/dsacl.py index b68af9ba39..a5d9703699 100644 --- a/source4/scripting/python/samba/netcmd/dsacl.py +++ b/source4/scripting/python/samba/netcmd/dsacl.py @@ -3,7 +3,6 @@ # Manipulate ACLs on directory objects # # Copyright (C) Nadezhda Ivanova 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -53,6 +52,12 @@ class cmd_dsacl_set(Command): synopsis = "%prog [options]" car_help = """ The access control right to allow or deny """ + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), diff --git a/source4/scripting/python/samba/netcmd/fsmo.py b/source4/scripting/python/samba/netcmd/fsmo.py index 4449a306a9..958e5b8719 100644 --- a/source4/scripting/python/samba/netcmd/fsmo.py +++ b/source4/scripting/python/samba/netcmd/fsmo.py @@ -4,7 +4,6 @@ # # Copyright Nadezhda Ivanova 2009 # Copyright Jelmer Vernooij 2009 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -39,6 +38,12 @@ class cmd_fsmo_seize(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), diff --git a/source4/scripting/python/samba/netcmd/gpo.py b/source4/scripting/python/samba/netcmd/gpo.py index 398a95122d..bd3480e053 100644 --- a/source4/scripting/python/samba/netcmd/gpo.py +++ b/source4/scripting/python/samba/netcmd/gpo.py @@ -3,7 +3,6 @@ # implement samba_tool gpo commands # # Copyright Andrew Tridgell 2010 -# Copyright Giampaolo Lauria 2011 # Copyright Amitay Isaacs 2011 # # based on C implementation by Guenther Deschner and Wilco Baan Hofman @@ -241,6 +240,12 @@ class cmd_listall(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H") @@ -273,6 +278,11 @@ class cmd_list(Command): synopsis = "%prog [options]" takes_args = ['username'] + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", diff --git a/source4/scripting/python/samba/netcmd/group.py b/source4/scripting/python/samba/netcmd/group.py index 9c9add8433..0bbfde6f20 100644 --- a/source4/scripting/python/samba/netcmd/group.py +++ b/source4/scripting/python/samba/netcmd/group.py @@ -5,7 +5,6 @@ # # Based on the original in EJS: # Copyright Andrew Tridgell 2005 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -69,6 +68,12 @@ Example2 adds a new distribution group to the local server. The command is run synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), @@ -131,6 +136,12 @@ Example2 deletes group Group2 from the local server. The command is run under r synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), @@ -173,6 +184,12 @@ Example2 shows how to add a single user account, User2, to the supergroup AD gro synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), @@ -217,6 +234,12 @@ Example2 shows how to remove a single user account, User2, from the supergroup A synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), diff --git a/source4/scripting/python/samba/netcmd/ldapcmp.py b/source4/scripting/python/samba/netcmd/ldapcmp.py index a6db4b11b0..75708decd0 100755 --- a/source4/scripting/python/samba/netcmd/ldapcmp.py +++ b/source4/scripting/python/samba/netcmd/ldapcmp.py @@ -8,7 +8,6 @@ # above partitions. # Copyright (C) Zahari Zahariev 2009, 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -863,6 +862,12 @@ class cmd_ldapcmp(Command): "credopts": options.CredentialsOptionsDouble, } + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptionsDouble, + } + takes_args = ["URL1", "URL2", "context1?", "context2?", "context3?"] takes_options = [ diff --git a/source4/scripting/python/samba/netcmd/ntacl.py b/source4/scripting/python/samba/netcmd/ntacl.py index 9f946139ad..96d4c975c9 100644 --- a/source4/scripting/python/samba/netcmd/ntacl.py +++ b/source4/scripting/python/samba/netcmd/ntacl.py @@ -3,7 +3,6 @@ # Manipulate file NT ACLs # # Copyright Matthieu Patou 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,6 +43,12 @@ class cmd_ntacl_set(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("--quiet", help="Be quiet", action="store_true"), Option("--xattr-backend", type="choice", help="xattr backend type (native fs or tdb)", @@ -80,6 +85,12 @@ class cmd_ntacl_get(Command): """Set ACLs on a file""" synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("--as-sddl", help="Output ACL in the SDDL format", action="store_true"), Option("--xattr-backend", type="choice", help="xattr backend type (native fs or tdb)", diff --git a/source4/scripting/python/samba/netcmd/rodc.py b/source4/scripting/python/samba/netcmd/rodc.py index b0500362ef..e990262e80 100644 --- a/source4/scripting/python/samba/netcmd/rodc.py +++ b/source4/scripting/python/samba/netcmd/rodc.py @@ -3,7 +3,6 @@ # rodc related commands # # Copyright Andrew Tridgell 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,6 +32,12 @@ class cmd_rodc_preload(Command): synopsis = "%prog (||) [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("--server", help="DC to use", type=str), ] diff --git a/source4/scripting/python/samba/netcmd/spn.py b/source4/scripting/python/samba/netcmd/spn.py index 0f01a49fc4..3b9db7407b 100644 --- a/source4/scripting/python/samba/netcmd/spn.py +++ b/source4/scripting/python/samba/netcmd/spn.py @@ -3,7 +3,6 @@ # spn management # # Copyright Matthieu Patou mat@samba.org 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -38,6 +37,12 @@ class cmd_spn_list(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["user"] def run(self, user, credopts=None, sambaopts=None, versionopts=None): @@ -75,6 +80,11 @@ class cmd_spn_add(Command): synopsis = "%prog [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } takes_options = [ Option("--force", help="Force the addition of the spn"\ " even it exists already", action="store_true"), @@ -129,6 +139,12 @@ class cmd_spn_delete(Command): synopsis = "%prog [user] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["name", "user?"] def run(self, name, user=None, credopts=None, sambaopts=None, versionopts=None): diff --git a/source4/scripting/python/samba/netcmd/testparm.py b/source4/scripting/python/samba/netcmd/testparm.py index 517196652b..8b45c646d4 100755 --- a/source4/scripting/python/samba/netcmd/testparm.py +++ b/source4/scripting/python/samba/netcmd/testparm.py @@ -4,7 +4,6 @@ # Unix SMB/CIFS implementation. # Test validity of smb.conf # Copyright (C) 2010-2011 Jelmer Vernooij -# Copyright (C) Giampaolo Lauria 2011 # # Based on the original in C: # Copyright (C) Karl Auer 1993, 1994-1998 @@ -51,6 +50,11 @@ class cmd_testparm(Command): "versionopts": options.VersionOptions } + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions + } + takes_options = [ Option("--section-name", type=str, help="Limit testparm to a named section"), diff --git a/source4/scripting/python/samba/netcmd/time.py b/source4/scripting/python/samba/netcmd/time.py index 966799e7db..cc63849c05 100644 --- a/source4/scripting/python/samba/netcmd/time.py +++ b/source4/scripting/python/samba/netcmd/time.py @@ -3,7 +3,6 @@ # time # # Copyright Jelmer Vernooij 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,6 +43,12 @@ Example2 return the date and time of the local server. """ synopsis = "%prog [server-name] [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_args = ["server_name?"] def run(self, server_name=None, credopts=None, sambaopts=None, versionopts=None): diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py index 23c7515259..a8cc2b840f 100644 --- a/source4/scripting/python/samba/netcmd/user.py +++ b/source4/scripting/python/samba/netcmd/user.py @@ -4,7 +4,6 @@ # # Copyright Jelmer Vernooij 2010 # Copyright Theresa Halloran 2011 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,12 +20,15 @@ # import samba.getopt as options -import sys, ldb +import ldb from getpass import getpass from samba.auth import system_session from samba.samdb import SamDB -from samba import gensec, generate_random_password -from samba import dsdb +from samba import ( + dsdb, + gensec, + generate_random_password, + ) from samba.net import Net from samba.netcmd import ( @@ -100,6 +102,12 @@ Example3 shows how to create a new user in the OrgUnit organizational unit. takes_args = ["username", "password?"] + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + def run(self, username, password=None, credopts=None, sambaopts=None, versionopts=None, H=None, must_change_at_next_login=False, random_password=False, use_username_as_cn=False, userou=None, surname=None, given_name=None, initials=None, @@ -163,6 +171,7 @@ sudo samba-tool user delete User2 Example2 shows how to delete a user in the domain against the local server. sudo is used so a user may run the command as root. +<<<<<<< HEAD """ synopsis = "%prog [options]" @@ -172,9 +181,13 @@ Example2 shows how to delete a user in the domain against the local server. su ] takes_args = ["username"] + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } def run(self, username, credopts=None, sambaopts=None, versionopts=None, H=None): - lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) @@ -197,6 +210,12 @@ class cmd_user_list(Command): metavar="URL", dest="H"), ] + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + def run(self, sambaopts=None, credopts=None, versionopts=None, H=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) @@ -250,6 +269,13 @@ Example3 shows how to enable a user in the domain against a local LDAP server. """ synopsis = "%prog (|--filter ) [options]" + + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), @@ -341,6 +367,12 @@ Example4 shows how to set the account expiration so that it will never expire. """ synopsis = "%prog (|--filter ) [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), @@ -442,6 +474,12 @@ Example3 shows how an administrator would reset TestUser3 user's password to pas """ synopsis = "%prog (|--filter ) [options]" + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "versionopts": options.VersionOptions, + "credopts": options.CredentialsOptions, + } + takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, metavar="URL", dest="H"), diff --git a/source4/scripting/python/samba/netcmd/vampire.py b/source4/scripting/python/samba/netcmd/vampire.py index 22a180a700..32777cba39 100644 --- a/source4/scripting/python/samba/netcmd/vampire.py +++ b/source4/scripting/python/samba/netcmd/vampire.py @@ -3,7 +3,6 @@ # Vampire # # Copyright Jelmer Vernooij 2010 -# Copyright Giampaolo Lauria 2011 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,6 +34,12 @@ class cmd_vampire(Command): """Join and synchronise a remote AD domain to the local server""" synopsis = "%prog [options] " + takes_optiongroups = { + "sambaopts": options.SambaOptions, + "credopts": options.CredentialsOptions, + "versionopts": options.VersionOptions, + } + takes_options = [ Option("--target-dir", help="Target directory.", type=str), Option("--force", help="force run", action='store_true', default=False), -- cgit