[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Wed May 19 11:35:49 MDT 2010


The branch, master has been updated
       via  ac93412... pynet: Raise proper exceptions rather than invoking sys.exit.
      from  d18fbda... testprogs/win32: make it possible to specify MINGW_CC

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ac9341245af38fe019c43ad9e413dbc62e26bc7a
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed May 19 00:26:56 2010 +0200

    pynet: Raise proper exceptions rather than invoking sys.exit.

-----------------------------------------------------------------------

Summary of changes:
 source4/scripting/python/samba/netcmd/newuser.py   |    8 ++++----
 .../scripting/python/samba/netcmd/setpassword.py   |    6 ++----
 2 files changed, 6 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/netcmd/newuser.py b/source4/scripting/python/samba/netcmd/newuser.py
index 9ffc0e6..bb5537a 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))
 
diff --git a/source4/scripting/python/samba/netcmd/setpassword.py b/source4/scripting/python/samba/netcmd/setpassword.py
index 098b3cb..d51e8ea 100644
--- a/source4/scripting/python/samba/netcmd/setpassword.py
+++ b/source4/scripting/python/samba/netcmd/setpassword.py
@@ -22,7 +22,6 @@
 
 import samba.getopt as options
 from samba.netcmd import Command, CommandError, Option
-import sys
 from getpass import getpass
 from samba.auth import system_session
 from samba.samdb import SamDB
@@ -73,6 +72,5 @@ class cmd_setpassword(Command):
                               force_change_at_next_login=must_change_at_next_login,
                               username=username)
         except:
-            print('Failed to set password for user "%s"' % username)
-            sys.exit(1)
-
+            raise CommandError('Failed to set password for user "%s"' %
+                username)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list