s4 upgradeprovision: fix a typo and pass correct parameter to increment_calculated_ke...
authorMatthieu Patou <mat@matws.net>
Tue, 10 Aug 2010 13:39:29 +0000 (17:39 +0400)
committerMatthieu Patou <mat@matws.net>
Thu, 19 Aug 2010 11:59:04 +0000 (15:59 +0400)
source4/scripting/bin/upgradeprovision
source4/scripting/python/samba/upgradehelpers.py

index 23c511f08127ddf2728944d284efcf7c3e433a85..f171aebe5891e09173fb756eba350788351a57ff 100755 (executable)
@@ -1335,9 +1335,10 @@ def sync_calculated_attributes(samdb, names):
       :param samdb: An LDB object attached to the currently upgraded samdb
       :param names: Various key parameter about current provision.
    """
-   listAttrs = ["msDs-KeyVersionAttribute"]
+   listAttrs = ["msDs-KeyVersionNumber"]
    hash = search_constructed_attrs_stored(samdb, names.rootdn, listAttrs)
-   increment_calculated_keyversion_number(samdb, names.rootdn, hash)
+   increment_calculated_keyversion_number(samdb, names.rootdn,
+                                            hash["msDs-KeyVersionNumber"])
 
 def setup_path(file):
     return os.path.join(setup_dir, file)
@@ -1658,6 +1659,6 @@ if __name__ == '__main__':
     except StandardError, err:
         message(ERROR,"A problem has occured when trying to upgrade your provision,"
                       " a full backup is located at %s" % backupdir)
-        if opts.changeall:
+        if opts.debugall or opts.debugchange:
             (typ, val, tb) = sys.exc_info()
             traceback.print_exception(typ, val, tb)
index 58106e0a708389d2c7ac50dd3e3df7ba513dd77a..2bc1795fbca7d2e277e02e0fd322bf6d92306d5f 100755 (executable)
@@ -737,12 +737,12 @@ def increment_calculated_keyversion_number(samdb, rootdn, hashDns):
     else:
         for e in entry:
             if hashDns.has_key(str(e.dn).lower()):
-                done = done + 1
                 val = e.get("msDs-KeyVersionNumber")
                 if not val:
                     continue
                 version = int(str(hashDns[str(e.dn).lower()]))
                 if int(str(val)) < version:
+                    done = done + 1
                     samdb.set_attribute_replmetadata_version(str(e.dn),
                                                               "unicodePwd",
                                                               version)