s4-net: use CommandError() in net rodc
authorAndrew Tridgell <tridge@samba.org>
Fri, 27 Aug 2010 02:08:49 +0000 (12:08 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 2 Sep 2010 03:37:07 +0000 (13:37 +1000)
this integrates better with the net command

Pair-Programmed-With: Jelmer Vernooij <jelmer@samba.org>

source4/scripting/python/samba/netcmd/rodc.py

index 8e3ebbf66d8f18f1f3169aa4bc88b50d3cdd6b24..0fdb252b60a7339a9259ed7c42c7f8b1d3d27d98 100644 (file)
@@ -104,18 +104,18 @@ class cmd_rodc_preload(Command):
         local_samdb.transaction_start()
         repl = drs_Replicate("ncacn_ip_tcp:%s[seal,print]" % server, lp, creds, local_samdb)
         try:
-            repl.replicate(dn, source_dsa_invocation_id, destination_dsa_guid, exop=drsuapi.DRSUAPI_EXOP_REPL_SECRET)
+            repl.replicate(dn, source_dsa_invocation_id, destination_dsa_guid,
+                           exop=drsuapi.DRSUAPI_EXOP_REPL_SECRET)
         except RuntimeError, (ecode, estring):
             if estring == 'WERR_DS_DRA_ACCESS_DENIED':
-                print "Access denied replicating DN %s" % dn
                 local_samdb.transaction_cancel()
-                # how do we fail a net command??
-                return False
+                raise CommandError("Access denied replicating DN %s" % dn)
             else:
                 raise
         local_samdb.transaction_commit()
 
 
+
 class cmd_rodc(SuperCommand):
     """RODC commands"""