|
|
e3ffab |
From 0717bc9dcaddf4f43bb9412af979b37a5a61c55b Mon Sep 17 00:00:00 2001
|
|
|
e3ffab |
From: Jan Cholasta <jcholast@redhat.com>
|
|
|
e3ffab |
Date: Tue, 20 Jan 2015 11:22:29 +0000
|
|
|
e3ffab |
Subject: [PATCH] Put LDIF files to their original location in ipa-restore
|
|
|
e3ffab |
|
|
|
e3ffab |
This prevents SELinux failures during online data restore.
|
|
|
e3ffab |
|
|
|
e3ffab |
https://fedorahosted.org/freeipa/ticket/4822
|
|
|
e3ffab |
|
|
|
e3ffab |
Reviewed-By: Martin Kosek <mkosek@redhat.com>
|
|
|
e3ffab |
---
|
|
|
e3ffab |
ipaserver/install/ipa_restore.py | 9 ++++++++-
|
|
|
e3ffab |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
e3ffab |
|
|
|
e3ffab |
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
|
|
|
e3ffab |
index be487166d9b2319aeee5fcb54bf4779afcac5afa..562a793c2c9383d7495c84a817ac9f7a1407f9bb 100644
|
|
|
e3ffab |
--- a/ipaserver/install/ipa_restore.py
|
|
|
e3ffab |
+++ b/ipaserver/install/ipa_restore.py
|
|
|
e3ffab |
@@ -504,10 +504,17 @@ class Restore(admintool.AdminTool):
|
|
|
e3ffab |
cn = time.strftime('import_%Y_%m_%d_%H_%M_%S')
|
|
|
e3ffab |
dn = DN(('cn', cn), ('cn', 'import'), ('cn', 'tasks'), ('cn', 'config'))
|
|
|
e3ffab |
|
|
|
e3ffab |
+ ldifdir = paths.SLAPD_INSTANCE_LDIF_DIR_TEMPLATE % instance
|
|
|
e3ffab |
ldifname = '%s-%s.ldif' % (instance, backend)
|
|
|
e3ffab |
+ ldiffile = os.path.join(ldifdir, ldifname)
|
|
|
e3ffab |
srcldiffile = os.path.join(self.dir, ldifname)
|
|
|
e3ffab |
- ldiffile = '%s.noruv' % srcldiffile
|
|
|
e3ffab |
|
|
|
e3ffab |
+ if not os.path.exists(ldifdir):
|
|
|
e3ffab |
+ pent = pwd.getpwnam(DS_USER)
|
|
|
e3ffab |
+ os.mkdir(ldifdir, 0770)
|
|
|
e3ffab |
+ os.chown(ldifdir, pent.pw_uid, pent.pw_gid)
|
|
|
e3ffab |
+
|
|
|
e3ffab |
+ ipautil.backup_file(ldiffile)
|
|
|
e3ffab |
with open(ldiffile, 'wb') as out_file:
|
|
|
e3ffab |
ldif_writer = ldif.LDIFWriter(out_file)
|
|
|
e3ffab |
with open(srcldiffile, 'rb') as in_file:
|
|
|
e3ffab |
--
|
|
|
e3ffab |
2.1.0
|
|
|
e3ffab |
|