ipa_restore: Restore SELinux context of template_dir /var/log/dirsrv/slapd-X

The template directory /var/log/dirsrv/slapd-X could be created with the
wrong SELinux context.

Related to: https://pagure.io/freeipa/issue/7662

Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Thomas Woerner
2018-08-02 11:32:05 +02:00
parent f751697924
commit 354d7297e8

View File

@@ -607,10 +607,13 @@ class Restore(admintool.AdminTool):
logger.info("Waiting for LDIF to finish")
wait_for_task(conn, dn)
else:
template_dir = paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance
try:
os.makedirs(paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance)
os.makedirs(template_dir)
except OSError as e:
pass
# Restore SELinux context of template_dir
tasks.restore_context(template_dir)
args = [paths.LDIF2DB,
'-Z', instance,