1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

Wrap makedirs() within exception handelrs

This commit is contained in:
OsirisInferi
2020-02-05 22:17:29 +01:00
parent 601a114d1b
commit f3ed133744

View File

@@ -169,8 +169,14 @@ class ApacheHttp01(common.ChallengePerformer):
def _set_up_challenges(self):
if not os.path.isdir(self.challenge_dir):
old_umask = os.umask(0o022)
filesystem.makedirs(self.challenge_dir, 0o755)
os.umask(old_umask)
try:
filesystem.makedirs(self.challenge_dir, 0o755)
except OSError as exception:
if exception.errno not in (errno.EEXIST, errno.EISDIR):
raise errors.PluginError(
"Couldn't create root for http-01 challenge")
finally:
os.umask(old_umask)
responses = []
for achall in self.achalls: