Handle rmdir failure

This commit is contained in:
Filip Ochnik 2016-02-17 17:04:10 +08:00
parent 9b5ff7bcd7
commit 4d9f487e89

View file

@ -144,6 +144,13 @@ to serve all files under specified web root ({0})."""
for root_path, achalls in six.iteritems(self.performed):
if not achalls:
logger.debug("All challenges cleaned up, removing %s",
root_path)
os.rmdir(root_path)
try:
os.rmdir(root_path)
logger.debug("All challenges cleaned up, removing %s",
root_path)
except OSError as exc:
if exc.errno == errno.ENOTEMPTY:
logger.debug("Challenges cleaned up but %s not empty",
root_path)
else:
raise