Yuvipanda has submitted this change and it was merged.
Change subject: Make sure storage-replicate only removes the lockdir if it held
the lock
......................................................................
Make sure storage-replicate only removes the lockdir if it held the lock
To avoid an aborted attempt cleaning up when it shouldn't.
Change-Id: Id5b8a8a9ef1a1150b5b84394d2392a4464328117
---
M modules/labstore/files/storage-replicate
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
Yuvipanda: Verified; Looks good to me, approved
diff --git a/modules/labstore/files/storage-replicate
b/modules/labstore/files/storage-replicate
index fa53340..74ad5e6 100755
--- a/modules/labstore/files/storage-replicate
+++ b/modules/labstore/files/storage-replicate
@@ -139,18 +139,21 @@
self.path = path
self.mountpoint = "%s/snapshot" % path
self.err = None
+ self.locked = False
def __enter__(self):
try:
os.mkdir(self.path, 0o700)
os.mkdir(self.mountpoint, 0o700)
+ self.locked = True
except OSError as e:
self.err = "unable to create lock directory %s: %s" % (self.path,
e.strerror)
return self
def __exit__(self, e1, e2, e3):
- (out, err) = self.ctx.run('/bin/umount', '-fl', self.mountpoint)
- (out, err) = self.ctx.run('/bin/rm', '-rf', self.path)
+ if self.locked:
+ (out, err) = self.ctx.run('/bin/umount', '-fl', self.mountpoint)
+ (out, err) = self.ctx.run('/bin/rm', '-rf', self.path)
return None
--
To view, visit https://gerrit.wikimedia.org/r/226892
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5b8a8a9ef1a1150b5b84394d2392a4464328117
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: coren <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits