Added lockfiles around link update

This commit is contained in:
Brad Warren
2015-10-12 18:07:21 -07:00
parent 5ca70e19a7
commit 3ee4ee0996
+11
View File
@@ -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: