samba_kcc: simplify NCReplica constructor
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 13 Dec 2017 04:50:56 +0000 (17:50 +1300)
committerKarolin Seeger <kseeger@samba.org>
Sat, 13 Jan 2018 16:37:07 +0000 (17:37 +0100)
There is nothing to be gained from setting the dn and guid separately
except subtle bugs.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/kcc/__init__.py
python/samba/kcc/kcc_utils.py

index 3c31ef6b4b5a4a4def7ad3a88b15c041c0a18b0a..273a68fa09f427894038d4c9c044874dc6e5889d 100644 (file)
@@ -2021,8 +2021,7 @@ class KCC(object):
 
         # Create a NCReplica that matches what the local replica
         # should say.  We'll use this below in our r_list
-        l_of_x = NCReplica(dc_local.dsa_dnstr, dc_local.dsa_guid,
-                           nc_x.nc_dnstr)
+        l_of_x = NCReplica(dc_local, nc_x.nc_dnstr)
 
         l_of_x.identify_by_basedn(self.samdb)
 
index 785349997f8f475807f30ac420144e280702ffd4..68cd6e677461f58ad19cd5304946ca9eedef3e85 100644 (file)
@@ -163,14 +163,14 @@ class NCReplica(NamingContext):
     class) and it identifies unique attributes of the DSA's replica for a NC.
     """
 
-    def __init__(self, dsa_dnstr, dsa_guid, nc_dnstr):
+    def __init__(self, dsa, nc_dnstr):
         """Instantiate a Naming Context Replica
 
         :param dsa_guid: GUID of DSA where replica appears
         :param nc_dnstr: NC dn string
         """
-        self.rep_dsa_dnstr = dsa_dnstr
-        self.rep_dsa_guid = dsa_guid
+        self.rep_dsa_dnstr = dsa.dsa_dnstr
+        self.rep_dsa_guid = dsa.dsa_guid
         self.rep_default = False  # replica for DSA's default domain
         self.rep_partial = False
         self.rep_ro = False
@@ -739,7 +739,7 @@ class DirectoryServiceAgent(object):
                     dnstr = str(dsdn.dn)
 
                     if not dnstr in tmp_table:
-                        rep = NCReplica(self.dsa_dnstr, self.dsa_guid, dnstr)
+                        rep = NCReplica(self, dnstr)
                         tmp_table[dnstr] = rep
                     else:
                         rep = tmp_table[dnstr]