979ee0
From be17d3c929027a5ef9f5024aa1bb4112006bb6f6 Mon Sep 17 00:00:00 2001
979ee0
From: Florence Blanc-Renaud <flo@redhat.com>
979ee0
Date: Mon, 6 Aug 2018 16:57:48 +0200
979ee0
Subject: [PATCH] Fix ipa-restore: create /var/run/ipa files
979ee0
979ee0
In ipa 4.5.4, ipa-restore fails because the file /etc/tmpfiles.d/ipa.conf
979ee0
is not restored => /var/run/ipa and /var/run/ipa/ccaches directories
979ee0
are not created.
979ee0
979ee0
The fix creates these directories in ipa-restore and creates ipa.conf.
979ee0
With this approach, the fix allows to restore a backup done with 4.5.4
979ee0
prior to the fix.
979ee0
979ee0
Note: the fix is specific to ipa-4-5, in ipa-4-6 and above version the file
979ee0
/etc/tmpfiles.d/ipa.conf is created at package install time and not at
979ee0
ipa server install time.
979ee0
979ee0
Fixes: https://pagure.io/freeipa/issue/7571
979ee0
Reviewed-By: Christian Heimes <cheimes@redhat.com>
979ee0
---
979ee0
 ipaserver/install/ipa_restore.py | 3 +++
979ee0
 1 file changed, 3 insertions(+)
979ee0
979ee0
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
979ee0
index a3824df230857b02b47c12645fadee1200afdf66..e069b8ba9b7a01e7602e66d4404063bbc2a1e795 100644
979ee0
--- a/ipaserver/install/ipa_restore.py
979ee0
+++ b/ipaserver/install/ipa_restore.py
979ee0
@@ -32,6 +32,7 @@ from six.moves.configparser import SafeConfigParser
979ee0
 from ipaclient.install.client import update_ipa_nssdb
979ee0
 from ipalib import api, errors
979ee0
 from ipalib.constants import FQDN
979ee0
+from ipalib.constants import IPAAPI_USER
979ee0
 from ipapython import version, ipautil
979ee0
 from ipapython.ipautil import run, user_input
979ee0
 from ipapython import admintool
979ee0
@@ -377,6 +378,8 @@ class Restore(admintool.AdminTool):
979ee0
             if restore_type == 'FULL':
979ee0
                 self.remove_old_files()
979ee0
                 self.cert_restore_prepare()
979ee0
+                tasks.create_tmpfiles_dirs(IPAAPI_USER)
979ee0
+                tasks.configure_tmpfiles()
979ee0
                 self.file_restore(options.no_logs)
979ee0
                 self.cert_restore()
979ee0
                 if 'CA' in self.backup_services:
979ee0
-- 
979ee0
2.17.1
979ee0