Browse Source

Ticket 49927 - dsctl db2index does not work

Description:  When you don't specify any attributes to index, then all attributes
              should be reindexed.  This is accomplished by using "ns-slapd upgradedb"
              but we were not using the correct command line options for this to work.

https://pagure.io/389-ds-base/issue/49927

Reviewed by: spichugi(Thanks!)
Mark Reynolds 7 years ago
parent
commit
6fe61010a4
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/lib389/lib389/__init__.py

+ 5 - 5
src/lib389/lib389/__init__.py

@@ -2961,22 +2961,22 @@ class DirSrv(SimpleLDAPObject, object):
             self.log.error("db2index: missing required backend name or suffix")
             return False
 
-        cmd = [prog,]
+        cmd = [prog, ]
         if attrs or vlvTag:
             cmd.append('db2index')
+            if bename:
+                cmd.append('-n')
+                cmd.append(bename)
         else:
             cmd.append('upgradedb')
             cmd.append('-a')
             now = datetime.now().isoformat()
             cmd.append(os.path.join(self.get_bak_dir(), 'reindex_%s' % now))
+            cmd.append('-f')
 
         cmd.append('-D')
         cmd.append(self.get_config_dir())
 
-        if bename:
-            cmd.append('-n')
-            cmd.append(bename)
-
         # Can only use suffiix in attr only mode.
         if suffixes and (attrs or vlvTag):
             for suffix in suffixes: