KCC: shift samba.ldif_utils to samba.kcc.ldif_import_export
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 5 Jun 2015 03:09:05 +0000 (15:09 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 12 Jun 2015 04:57:13 +0000 (06:57 +0200)
These functions are really only of use for KCC, and they only import and
export rather than be general utils.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/kcc/__init__.py
python/samba/kcc/ldif_import_export.py [moved from python/samba/ldif_utils.py with 99% similarity]
python/samba/tests/ldif_utils.py
source4/scripting/bin/samba_kcc

index 1f13627bfd9dba23b1f68b01b3cd6f8b14d778eb..99b5afc8df58ea10ce95857de8a73340450fb8b1 100644 (file)
@@ -37,8 +37,8 @@ from samba.kcc.kcc_utils import convert_schedule_to_repltimes
 from samba.ndr import ndr_pack
 
 from samba.kcc.graph_utils import verify_and_dot
-from samba import ldif_utils
 
+from samba.kcc import ldif_import_export
 from samba.kcc.graph import setup_graph, get_spanning_tree_edges
 from samba.kcc.graph import Vertex
 
@@ -2667,9 +2667,9 @@ class KCC(object):
         :param ldif_file: path to the ldif file to import
         """
         try:
-            self.samdb = ldif_utils.ldif_to_samdb(dburl, lp, ldif_file,
-                                                  self.forced_local_dsa)
-        except ldif_utils.LdifError, e:
+            self.samdb = ldif_import_export.ldif_to_samdb(dburl, lp, ldif_file,
+                                                          self.forced_local_dsa)
+        except ldif_import_export.LdifError, e:
             print e
             return 1
         return 0
@@ -2690,9 +2690,9 @@ class KCC(object):
         :param ldif_file: output LDIF file name to create
         """
         try:
-            ldif_utils.samdb_to_ldif_file(self.samdb, dburl, lp, creds,
-                                          ldif_file)
-        except ldif_utils.LdifError, e:
+            ldif_import_export.samdb_to_ldif_file(self.samdb, dburl, lp, creds,
+                                                  ldif_file)
+        except ldif_import_export.LdifError, e:
             print e
             return 1
         return 0
similarity index 99%
rename from python/samba/ldif_utils.py
rename to python/samba/kcc/ldif_import_export.py
index 47f4fd0fa7865076c7ac19d1df649667e8bc9a5c..ab7c7a0a1bf850a659c30ffb2ea88c5b8d08bce7 100644 (file)
@@ -1,5 +1,4 @@
-#
-# LDIF helper fucntions, originally from the samba_kcc tool
+# LDIF helper functions for the samba_kcc tool
 #
 # Copyright (C) Dave Craft 2011
 # Copyright (C) Andrew Bartlett 2015
index 73eccfe2c5d00de8397a711b43ef823a27329f4f..a7b83fefa90fda5c3c0a8b2a5c78ffef8e186e7a 100644 (file)
@@ -1,4 +1,4 @@
-# Unix SMB/CIFS implementation. Tests for graph_utils.py routines
+# Unix SMB/CIFS implementation. Tests for samba.kcc.ldif_import_export.
 # Copyright (C) Andrew Bartlett 2015
 #
 # Written by Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-"""Tests for samba.ldif_utils"""
+"""Tests for samba.kcc.ldif_import_export"""
 
 import samba
 import os
 from tempfile import mkdtemp
 
 import samba.tests
-from samba import ldif_utils
+from samba.kcc import ldif_import_export
 from samba import ldb
 from samba.dcerpc import misc
 
index 4abec6f3803efdb1063426b3fb06fe8b362f3d3e..0d3de445c59c254373d2bca58498b2308b891ef3 100755 (executable)
@@ -56,7 +56,7 @@ from samba import (
 from samba.auth import system_session
 from samba.samdb import SamDB
 from samba.dcerpc import drsuapi
-from samba import ldif_utils
+from samba.kcc import ldif_import_export
 from samba.kcc.kcc_utils import *
 from samba.kcc.graph import *
 from samba.kcc.debug import *
@@ -2667,9 +2667,9 @@ class KCC(object):
         :param ldif_file: path to the ldif file to import
         """
         try:
-            self.samdb = ldif_utils.ldif_to_samdb(dburl, lp, ldif_file,
-                                                  opts.forced_local_dsa)
-        except ldif_utils.LdifError, e:
+            self.samdb = ldif_import_export.ldif_to_samdb(dburl, lp, ldif_file,
+                                                          opts.forced_local_dsa)
+        except ldif_import_export.LdifError, e:
             print e
             return 1
         return 0
@@ -2690,9 +2690,9 @@ class KCC(object):
         :param ldif_file: output LDIF file name to create
         """
         try:
-            ldif_utils.samdb_to_ldif_file(self.samdb, dburl, lp, creds,
+            ldif_import_export.samdb_to_ldif_file(self.samdb, dburl, lp, creds,
                                           ldif_file)
-        except ldif_utils.LdifError, e:
+        except ldif_import_export.LdifError, e:
             print e
             return 1
         return 0