diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-05-19 00:26:56 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-05-19 19:35:22 +0200 |
commit | ac9341245af38fe019c43ad9e413dbc62e26bc7a (patch) | |
tree | 1f183291d4f882fd289e8a42cc5748bd8e53f1fe /source4/scripting/python/samba/netcmd/newuser.py | |
parent | d18fbda0d0bd7d4cd702e1feb80d5803a4afcc39 (diff) | |
download | samba-ac9341245af38fe019c43ad9e413dbc62e26bc7a.tar.gz samba-ac9341245af38fe019c43ad9e413dbc62e26bc7a.tar.xz samba-ac9341245af38fe019c43ad9e413dbc62e26bc7a.zip |
pynet: Raise proper exceptions rather than invoking sys.exit.
Diffstat (limited to 'source4/scripting/python/samba/netcmd/newuser.py')
-rw-r--r-- | source4/scripting/python/samba/netcmd/newuser.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source4/scripting/python/samba/netcmd/newuser.py b/source4/scripting/python/samba/netcmd/newuser.py index 9ffc0e65254..bb5537aaf02 100644 --- a/source4/scripting/python/samba/netcmd/newuser.py +++ b/source4/scripting/python/samba/netcmd/newuser.py @@ -20,8 +20,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import samba.getopt as options -from samba.netcmd import Command, Option -import sys, ldb +from samba.netcmd import Command, CommandError, Option +import ldb from getpass import getpass from samba.auth import system_session @@ -61,6 +61,6 @@ class cmd_newuser(Command): samdb.newuser(username, password, force_password_change_at_next_login_req=must_change_at_next_login) except ldb.LdbError, (num, msg): - print('Failed to create user "%s" : %s' % (username, msg)) - sys.exit(1) + raise CommandError('Failed to create user "%s" : %s' % ( + username, msg)) |