1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

samba-tool: Test gpo manage script startup remove command

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Mulder 2021-02-12 14:49:16 -07:00 committed by Jeremy Allison
parent e5efe17246
commit 91655e6d71
3 changed files with 51 additions and 0 deletions

View File

@ -3221,11 +3221,40 @@ samba-tool gpo manage scripts startup add {31B2F340-016D-11D2-945F-00C04FB984F9}
"not have sufficient privileges")
raise
class cmd_remove_startup(Command):
"""Removes VGP Startup Script Group Policy from the sysvol
This command removes a startup script policy from the sysvol.
Example:
samba-tool gpo manage scripts startup remove {31B2F340-016D-11D2-945F-00C04FB984F9} test_script.sh
"""
synopsis = "%prog <gpo> <script> [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"),
]
takes_args = ["gpo", "script"]
def run(self, gpo, script, H=None, sambaopts=None, credopts=None,
versionopts=None):
pass
class cmd_startup(SuperCommand):
"""Manage Startup Scripts Group Policy Objects"""
subcommands = {}
subcommands["list"] = cmd_list_startup()
subcommands["add"] = cmd_add_startup()
subcommands["remove"] = cmd_remove_startup()
class cmd_scripts(SuperCommand):
"""Manage Scripts Group Policy Objects"""

View File

@ -1161,6 +1161,27 @@ class GpoCmdTestCase(SambaToolCmdTest):
self.assertTrue(os.path.exists(local_script_path),
'The test script was not uploaded to the sysvol')
(result, out, err) = self.runsublevelcmd("gpo", ("manage",
"scripts", "startup",
"remove"), self.gpo_guid,
f.name, "-H",
"ldap://%s" %
os.environ["SERVER"],
"-U%s%%%s" %
(os.environ["USERNAME"],
os.environ["PASSWORD"]))
self.assertCmdSuccess(result, out, err, 'Script remove failed')
(result, out, err) = self.runsublevelcmd("gpo", ("manage", "scripts",
"startup", "list"),
self.gpo_guid, "-H",
"ldap://%s" %
os.environ["SERVER"],
"-U%s%%%s" %
(os.environ["USERNAME"],
os.environ["PASSWORD"]))
self.assertNotIn(entry, out, 'The test entry was still found!')
def test_startup_script_list(self):
lp = LoadParm()
lp.load(os.environ['SERVERCONFFILE'])

1
selftest/knownfail.d/gpo Normal file
View File

@ -0,0 +1 @@
^samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.test_startup_script_add