From cc5d9a8c9de3db863ca181348bfb01506f74302d Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 21 Sep 2020 17:35:41 -0400 Subject: [PATCH] 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 Reviewed-By: Christian Heimes --- ipaplatform/base/paths.py | 1 + ipaserver/install/httpinstance.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py index 631086945..17f10e6b6 100644 --- a/ipaplatform/base/paths.py +++ b/ipaplatform/base/paths.py @@ -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" diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py index 0fcc370e5..0a9736df2 100644 --- a/ipaserver/install/httpinstance.py +++ b/ipaserver/install/httpinstance.py @@ -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()