Clean up entire /run/ipa/ccaches directory not just files

If there are any sub-directories in the ccaches directory
then cleaning it up will fail.

Instead remove the whole directory and allow systemd-tmpfiles
to re-create it.

https://pagure.io/freeipa/issue/8248

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Rob Crittenden
2020-09-21 17:35:41 -04:00
committed by Christian Heimes
parent 36c6a2e749
commit cc5d9a8c9d
2 changed files with 6 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ class BasePathNamespace:
LS = "/bin/ls"
SYSTEMCTL = "/bin/systemctl"
SYSTEMD_DETECT_VIRT = "/usr/bin/systemd-detect-virt"
SYSTEMD_TMPFILES = "/usr/bin/systemd-tmpfiles"
TAR = "/bin/tar"
AUTOFS_LDAP_AUTH_CONF = "/etc/autofs_ldap_auth.conf"
ETC_FEDORA_RELEASE = "/etc/fedora-release"

View File

@@ -26,6 +26,7 @@ import glob
import errno
import shlex
import pipes
import shutil
import tempfile
from augeas import Augeas
@@ -172,8 +173,10 @@ class HTTPInstance(service.Service):
# Make sure that empty env is passed to avoid passing KRB5CCNAME from
# current env
ipautil.remove_file(paths.HTTP_CCACHE)
for f in os.listdir(paths.IPA_CCACHES):
os.remove(os.path.join(paths.IPA_CCACHES, f))
shutil.rmtree(paths.IPA_CCACHES)
ipautil.run(
[paths.SYSTEMD_TMPFILES, '--create', '--prefix', paths.IPA_CCACHES]
)
def __configure_http(self):
self.update_httpd_service_ipa_conf()