1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

s4-upgradeprovision: clean up, reformating and update docs

This commit is contained in:
Matthieu Patou 2011-06-13 17:56:17 +04:00 committed by Matthieu Patou
parent 20233cdf53
commit 9a18e07b4f

View File

@ -412,14 +412,14 @@ def handle_special_case(att, delta, new, old, useReplMetadata, basedn, aldb):
if (att == "servicePrincipalName" and flag == FLAG_MOD_REPLACE):
hash = {}
newval = []
changeDelta=0
changeDelta = 0
for elem in old[0][att]:
hash[str(elem)]=1
newval.append(str(elem))
for elem in new[0][att]:
if not hash.has_key(str(elem)):
changeDelta=1
changeDelta = 1
newval.append(str(elem))
if changeDelta == 1:
delta[att] = MessageElement(newval, FLAG_MOD_REPLACE, att)
@ -1109,8 +1109,8 @@ def update_partition(ref_samdb, samdb, basedn, names, schema, provisionUSNs, pre
:param basedn: String value of the DN of the partition
:param names: List of key provision parameters
:param schema: A Schema object
:param provisionUSNs: The USNs modified by provision/upgradeprovision
last time
:param provisionUSNs: A dictionnary with range of USN modified during provision
or upgradeprovision. Ranges are grouped by invocationID.
:param prereloadfunc: A function that must be executed just before the reload
of the schema
"""
@ -1309,7 +1309,6 @@ def removeProvisionUSN(samdb):
attrs = [samba.provision.LAST_PROVISION_USN_ATTRIBUTE, "dn"]
entry = samdb.search(expression="dn=@PROVISION", base = "",
scope=SCOPE_SUBTREE,
controls=["search_options:1:2"],
attrs=attrs)
empty = Message()
empty.dn = entry[0].dn
@ -1379,7 +1378,7 @@ def update_privilege(ref_private_path, cur_private_path):
os.path.join(cur_private_path, "privilege.ldb"))
def update_samdb(ref_samdb, samdb, names, highestUSN, schema, prereloadfunc):
def update_samdb(ref_samdb, samdb, names, provisionUSNs, schema, prereloadfunc):
"""Upgrade the SAM DB contents for all the provision partitions
:param ref_sambdb: An LDB object conntected to the sam.ldb of the reference
@ -1387,8 +1386,8 @@ def update_samdb(ref_samdb, samdb, names, highestUSN, schema, prereloadfunc):
:param samdb: An LDB object connected to the sam.ldb of the update
provision
:param names: List of key provision parameters
:param highestUSN: The highest USN modified by provision/upgradeprovision
last time
:param provisionUSNs: A dictionnary with range of USN modified during provision
or upgradeprovision. Ranges are grouped by invocationID.
:param schema: A Schema object that represent the schema of the provision
:param prereloadfunc: A function that must be executed just before the reload
of the schema
@ -1396,7 +1395,7 @@ def update_samdb(ref_samdb, samdb, names, highestUSN, schema, prereloadfunc):
message(SIMPLE, "Starting update of samdb")
ret = update_partition(ref_samdb, samdb, str(names.rootdn), names,
schema, highestUSN, prereloadfunc)
schema, provisionUSNs, prereloadfunc)
if ret:
message(SIMPLE, "Update of samdb finished")
return 1