python/join: improve logging of join_replicate()
authorStefan Metzmacher <metze@samba.org>
Thu, 10 Feb 2022 15:57:01 +0000 (16:57 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 30 Mar 2022 11:13:35 +0000 (11:13 +0000)
It's useful to have timestamps to see the
time used for replication and committing.
We also warn the user that the committing stage
may take some time.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/join.py

index 4399367c817dab7e1e17c541d9cc3d69143583b4..91ed6da11473ec561160efa55f893f67160b4303 100644 (file)
@@ -936,7 +936,7 @@ class DCJoinContext(object):
     def join_replicate(ctx):
         """Replicate the SAM."""
 
-        print("Starting replication")
+        ctx.logger.info("Starting replication")
         ctx.local_samdb.transaction_start()
         try:
             source_dsa_invocation_id = misc.GUID(ctx.samdb.get_invocation_id())
@@ -1016,12 +1016,13 @@ class DCJoinContext(object):
             ctx.source_dsa_invocation_id = source_dsa_invocation_id
             ctx.destination_dsa_guid = destination_dsa_guid
 
-            print("Committing SAM database")
+            ctx.logger.info("Committing SAM database - this may take some time")
         except:
             ctx.local_samdb.transaction_cancel()
             raise
         else:
             ctx.local_samdb.transaction_commit()
+            ctx.logger.info("Committed SAM database")
 
         # A large replication may have caused our LDB connection to the
         # remote DC to timeout, so check the connection is still alive