s4-net: don't show a full python exception when you can't open sam.ldb
authorAndrew Tridgell <tridge@samba.org>
Tue, 20 Apr 2010 10:30:41 +0000 (20:30 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 20 Apr 2010 10:59:24 +0000 (20:59 +1000)
source4/scripting/python/samba/netcmd/newuser.py

index f3babfe780c0dcf377c378cc307c909dd8f9b39b..64b6d1715ce6b55b4148aa00a397575ea3b2e616 100644 (file)
@@ -60,9 +60,9 @@ class cmd_newuser(Command):
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp)
 
-        samdb = SamDB(url=H, session_info=system_session(), credentials=creds,
-            lp=lp)
         try:
+            samdb = SamDB(url=H, session_info=system_session(), credentials=creds,
+                          lp=lp)
             samdb.newuser(username, unixname, password,
                           force_password_change_at_next_login_req=must_change_at_next_login)
         except ldb.LdbError, (num, msg):