From 3ee4ee0996bf55e09913d6ca36cb66b2fd868528 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Mon, 12 Oct 2015 18:07:21 -0700 Subject: [PATCH] Added lockfiles around link update --- letsencrypt/storage.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/letsencrypt/storage.py b/letsencrypt/storage.py index 8a0f4829e..354ea6b7c 100644 --- a/letsencrypt/storage.py +++ b/letsencrypt/storage.py @@ -378,9 +378,20 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes :param int version: the desired version""" + lockfiles = [] + for kind in ALL_FOUR: + lockfile = os.path.join(os.path.dirname(getattr(self, kind)), + "{0}.lock".format(kind)) + with open(lockfile, "w") as f: + f.write("{0}\n".format(self.current_target(kind))) + lockfiles.append(lockfile) + for kind in ALL_FOUR: self._update_link_to(kind, version) + for lockfile in lockfiles: + os.unlink(lockfile) + def _notafterbefore(self, method, version): """Internal helper function for finding notbefore/notafter.""" if version is None: