From 6a73d2dac6dc93c243479a4b84c3ac8cdeb6a71f Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Fri, 4 Nov 2016 12:40:26 +0100 Subject: [PATCH] Ticket 49024 - Fix db_dir paths Description: Wrong usage of db_dir path causes an instance restart failure when plugins that envolve that directory are enabled. Set them properly through the code. https://fedorahosted.org/389/ticket/49024 Reviewed by: ? --- lib389/__init__.py | 10 +++++----- lib389/changelog.py | 2 +- lib389/tools.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib389/__init__.py b/lib389/__init__.py index 868c547..cfcc968 100644 --- a/lib389/__init__.py +++ b/lib389/__init__.py @@ -1408,8 +1408,8 @@ class DirSrv(SimpleLDAPObject): # # previous db (it may exists new db files not in the backup) - log.debug("restoreFS: remove subtree %s/*" % self.dbdir) - for root, dirs, files in os.walk(self.dbdir): + log.debug("restoreFS: remove subtree %s/*" % self.inst_dir) + for root, dirs, files in os.walk(self.inst_dir): for d in dirs: if d not in ("bak", "ldif"): log.debug("restoreFS: before restore remove directory" + @@ -1461,7 +1461,7 @@ class DirSrv(SimpleLDAPObject): # # Now be safe, triggers a recovery at restart # - guardian_file = os.path.join(self.dbdir, "db/guardian") + guardian_file = os.path.join(self.dbdir, "guardian") if os.path.isfile(guardian_file): try: log.debug("restoreFS: remove %s" % guardian_file) @@ -2709,9 +2709,9 @@ class DirSrv(SimpleLDAPObject): log.error("dbscan: missing required index name") return False elif '.db' in index: - indexfile = "%s/db/%s/%s" % (self.dbdir, bename, index) + indexfile = os.path.join(self.dbdir, bename, index) else: - indexfile = "%s/db/%s/%s.db" % (self.dbdir, bename, index) + indexfile = os.path.join(self.dbdir, bename, index) option = '' if 'id2entry' in index: diff --git a/lib389/changelog.py b/lib389/changelog.py index 071d9f9..2570513 100644 --- a/lib389/changelog.py +++ b/lib389/changelog.py @@ -45,7 +45,7 @@ class Changelog(object): """ dn = DN_CHANGELOG attribute, changelog_name = dn.split(",")[0].split("=", 1) - dirpath = os.path.join(self.conn.dbdir, dbname) + dirpath = os.path.join(self.conn.inst_dir, dbname) entry = Entry(dn) entry.update({ 'objectclass': ("top", "extensibleobject"), diff --git a/lib389/tools.py b/lib389/tools.py index 5b9f7ca..9babf44 100644 --- a/lib389/tools.py +++ b/lib389/tools.py @@ -370,8 +370,8 @@ class DirSrvTools(object): # # previous db (it may exists new db files not in the backup) - log.debug("instanceRestoreFS: remove subtree %s/*" % dirsrv.dbdir) - for root, dirs, files in os.walk(dirsrv.dbdir): + log.debug("instanceRestoreFS: remove subtree %s/*" % dirsrv.inst_dir) + for root, dirs, files in os.walk(dirsrv.inst_dir): for d in dirs: if d not in ("bak", "ldif"): log.debug( @@ -418,7 +418,7 @@ class DirSrvTools(object): # # Now be safe, triggers a recovery at restart # - guardian_file = os.path.join(dirsrv.dbdir, "db/guardian") + guardian_file = os.path.join(dirsrv.dbdir, "guardian") if os.path.isfile(guardian_file): try: log.debug("instanceRestoreFS: remove %s" % guardian_file) -- 2.7.4