summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-08-12 01:25:27 +0400
committerMatthieu Patou <mat@matws.net>2010-08-19 15:59:04 +0400
commiteaf1d050febc4d9ebf6cde9fd671ac5362d10e29 (patch)
tree5521f29855c4d28ba6abb10fb8728bd3eaf3d984 /source4/scripting
parent3e49b20cf0b0cadccc4e5b5ff3d20cbf60eeb3c4 (diff)
downloadsamba-eaf1d050febc4d9ebf6cde9fd671ac5362d10e29.tar.gz
samba-eaf1d050febc4d9ebf6cde9fd671ac5362d10e29.tar.bz2
samba-eaf1d050febc4d9ebf6cde9fd671ac5362d10e29.zip
s4 upgradeprovision: upgrade_delta_samdb return a msg_diff of @ATTRIBUTES
This is used by upgradeprovision to readd this delta just before loading a merged schema
Diffstat (limited to 'source4/scripting')
-rwxr-xr-xsource4/scripting/python/samba/upgradehelpers.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py
index cc8322f361..a588a84346 100755
--- a/source4/scripting/python/samba/upgradehelpers.py
+++ b/source4/scripting/python/samba/upgradehelpers.py
@@ -746,27 +746,29 @@ def increment_calculated_keyversion_number(samdb, rootdn, hashDns):
done = done + 1
samdb.set_attribute_replmetadata_version(str(e.dn),
"unicodePwd",
- version)
-
-def delta_update_basesamdb(refsam, sam, creds, session, lp, message):
+ version, True)
+def delta_update_basesamdb(refsampath, sampath, creds, session, lp, message):
"""Update the provision container db: sam.ldb
This function is aimed for alpha9 and newer;
- :param refsam: Path to the samdb in the reference provision
- :param sam: Path to the samdb in the upgraded provision
+ :param refsampath: Path to the samdb in the reference provision
+ :param sampath: Path to the samdb in the upgraded provision
:param creds: Credential used for openning LDB files
:param session: Session to use for openning LDB files
- :param lp: A loadparam object"""
+ :param lp: A loadparam object
+ :return: A msg_diff object with the difference between the @ATTRIBUTES
+ of the current provision and the reference provision
+ """
message(SIMPLE,
"Update base samdb by searching difference with reference one")
- refsam = Ldb(refsam, session_info=session, credentials=creds,
+ refsam = Ldb(refsampath, session_info=session, credentials=creds,
lp=lp, options=["modules:"])
- sam = Ldb(sam, session_info=session, credentials=creds, lp=lp,
+ sam = Ldb(sampath, session_info=session, credentials=creds, lp=lp,
options=["modules:"])
empty = ldb.Message()
-
+ deltaattr = None
reference = refsam.search(expression="")
for refentry in reference:
@@ -782,6 +784,8 @@ def delta_update_basesamdb(refsam, sam, creds, session, lp, message):
sam.add(delta)
else:
delta = sam.msg_diff(entry[0], refentry)
+ if str(refentry.dn) == "@ATTRIBUTES":
+ deltaattr = sam.msg_diff(refentry, entry[0])
if str(refentry.dn) == "@PROVISION" and\
delta.get(samba.provision.LAST_PROVISION_USN_ATTRIBUTE):
delta.remove(samba.provision.LAST_PROVISION_USN_ATTRIBUTE)
@@ -789,6 +793,7 @@ def delta_update_basesamdb(refsam, sam, creds, session, lp, message):
delta.dn = refentry.dn
sam.modify(delta)
+ return deltaattr
def construct_existor_expr(attrs):
"""Construct a exists or LDAP search expression.