https://fedorahosted.org/freeipa/ticket/4051
--
David Kupka
From da898ff6fbe760ff6786763297ecbf31bf10d300 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 1 Apr 2015 11:27:36 -0400
Subject: [PATCH] Use 389-ds centralized scripts.

Directory server is deprecating use of tools in instance specific paths. Instead
tools in bin/sbin path should be used.

https://fedorahosted.org/freeipa/ticket/4051
---
 ipaplatform/base/paths.py        |  4 ++++
 ipaserver/install/ipa_backup.py  |  5 +++--
 ipaserver/install/ipa_restore.py | 11 +++++++++--
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9ba87523b5619188f02bdad6c23d2446a2c4b0f2..6c0dd2bb458a87d523b60983a05479371a6b8d71 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -337,6 +337,10 @@ class BasePathNamespace(object):
     ALL_SLAPD_INSTANCE_SOCKETS = "/var/run/slapd-*.socket"
     ADMIN_CERT_PATH = '/root/.dogtag/pki-tomcat/ca_admin.cert'
     ENTROPY_AVAIL = '/proc/sys/kernel/random/entropy_avail'
+    LDIF2DB = '/usr/sbin/ldif2db'
+    DB2LDIF = '/usr/sbin/db2ldif'
+    BAK2DB = '/usr/sbin/bak2db'
+    DB2BAK = '/usr/sbin/db2bak'
 
 
 
diff --git a/ipaserver/install/ipa_backup.py b/ipaserver/install/ipa_backup.py
index c3611b241d4818bc718d8bcd83da8d3c1755457e..01871c7b57a3e491cebf8fe81f040268992f1ada 100644
--- a/ipaserver/install/ipa_backup.py
+++ b/ipaserver/install/ipa_backup.py
@@ -417,7 +417,8 @@ class Backup(admintool.AdminTool):
             self.log.info("Waiting for LDIF to finish")
             wait_for_task(conn, dn)
         else:
-            args = ['%s/db2ldif' % self.__find_scripts_dir(instance),
+            args = [paths.DB2LDIF,
+                    '-Z', instance,
                     '-r',
                     '-n', backend,
                     '-a', ldiffile]
@@ -464,7 +465,7 @@ class Backup(admintool.AdminTool):
             self.log.info("Waiting for BAK to finish")
             wait_for_task(conn, dn)
         else:
-            args = ['%s/db2bak' % self.__find_scripts_dir(instance), bakdir]
+            args = [paths.DB2BAK, bakdir, '-Z', instance]
             (stdout, stderr, rc) = run(args, raiseonerr=False)
             if rc != 0:
                 self.log.critical("db2bak failed: %s" % stderr)
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
index 56d31376570fc4e1ce9046ff8d323e2cc49e0c9e..528a6daf0d4b6d3dfc69b6bbf8e8b05ad91ce02d 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -544,7 +544,13 @@ class Restore(admintool.AdminTool):
             self.log.info("Waiting for LDIF to finish")
             wait_for_task(conn, dn)
         else:
-            args = ['%s/ldif2db' % self.__find_scripts_dir(instance),
+            try:
+                os.makedirs(paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance)
+            except OSError as e:
+                pass
+
+            args = [paths.LDIF2DB,
+                    '-Z', instance,
                     '-i', ldiffile,
                     '-n', backend]
             (stdout, stderr, rc) = run(args, raiseonerr=False)
@@ -596,7 +602,8 @@ class Restore(admintool.AdminTool):
             self.log.info("Waiting for restore to finish")
             wait_for_task(conn, dn)
         else:
-            args = ['%s/bak2db' % self.__find_scripts_dir(instance),
+            args = [paths.BAK2DB,
+                    '-Z', instance,
                     os.path.join(self.dir, instance)]
             if backend is not None:
                 args.append('-n')
-- 
2.4.2

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to