summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/user.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py
index bbc972bcc7..a5750b5010 100644
--- a/source4/scripting/python/samba/netcmd/user.py
+++ b/source4/scripting/python/samba/netcmd/user.py
@@ -24,6 +24,7 @@ from samba.net import Net
from samba.netcmd import (
Command,
+ CommandError,
SuperCommand,
)
@@ -64,7 +65,10 @@ class cmd_user_delete(Command):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp, fallback_machine=True)
net = Net(creds, lp, server=credopts.ipaddress)
- net.delete_user(name)
+ try:
+ net.delete_user(name)
+ except RuntimeError, msg:
+ raise CommandError("Failed to delete user %s: %s" % (name, msg))
class cmd_user(SuperCommand):