diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-01-20 11:22:29 +0000 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2015-01-21 08:27:44 +0100 |
commit | 4994cd1d8dde69d94130894ca86aa8a11fb590bf (patch) | |
tree | 501537207cf7fec359f4a58d09258b063c923b85 /ipaserver | |
parent | 251c97cf96edccaec5ce034007068609ad69227f (diff) | |
download | freeipa-4994cd1d8dde69d94130894ca86aa8a11fb590bf.tar.gz freeipa-4994cd1d8dde69d94130894ca86aa8a11fb590bf.tar.xz freeipa-4994cd1d8dde69d94130894ca86aa8a11fb590bf.zip |
Put LDIF files to their original location in ipa-restore
This prevents SELinux failures during online data restore.
https://fedorahosted.org/freeipa/ticket/4822
Reviewed-By: Martin Kosek <mkosek@redhat.com>
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/install/ipa_restore.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index d93ddc79e..b65a3f3fc 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -503,10 +503,17 @@ class Restore(admintool.AdminTool): cn = time.strftime('import_%Y_%m_%d_%H_%M_%S') dn = DN(('cn', cn), ('cn', 'import'), ('cn', 'tasks'), ('cn', 'config')) + ldifdir = paths.SLAPD_INSTANCE_LDIF_DIR_TEMPLATE % instance ldifname = '%s-%s.ldif' % (instance, backend) + ldiffile = os.path.join(ldifdir, ldifname) srcldiffile = os.path.join(self.dir, ldifname) - ldiffile = '%s.noruv' % srcldiffile + if not os.path.exists(ldifdir): + pent = pwd.getpwnam(DS_USER) + os.mkdir(ldifdir, 0770) + os.chown(ldifdir, pent.pw_uid, pent.pw_gid) + + ipautil.backup_file(ldiffile) with open(ldiffile, 'wb') as out_file: ldif_writer = ldif.LDIFWriter(out_file) with open(srcldiffile, 'rb') as in_file: |