projects
/
chef.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e1eee79
)
Don't warn when the tile cleanup script can't get a lock
author
Tom Hughes
<tom@compton.nu>
Sun, 6 Oct 2013 09:18:26 +0000
(10:18 +0100)
committer
Tom Hughes
<tom@compton.nu>
Sun, 6 Oct 2013 09:18:26 +0000
(10:18 +0100)
cookbooks/tile/templates/default/cleanup-tiles.erb
patch
|
blob
|
history
diff --git
a/cookbooks/tile/templates/default/cleanup-tiles.erb
b/cookbooks/tile/templates/default/cleanup-tiles.erb
index 9209a2644d8116663b16cbfc60b951ba52981625..0f9bff288e16f0027a01828628efe1b5d185c4ca 100644
(file)
--- a/
cookbooks/tile/templates/default/cleanup-tiles.erb
+++ b/
cookbooks/tile/templates/default/cleanup-tiles.erb
@@
-7,11
+7,13
@@
use warnings;
use File::Temp qw(tmpnam);
use Filesys::Df;
-use LockFile::Simple
qw(lock unlock)
;
+use LockFile::Simple;
my $tiledir = shift @ARGV;
-lock($tiledir) || exit 0;
+my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 0, -warn => 0);
+
+$lockmgr->lock($tiledir) || exit 0;
my $tempfile = tmpnam();
@@
-49,6
+51,6
@@
if (df($tiledir)->{per} > 90)
unlink($tempfile);
-unlock($tiledir);
+
$lockmgr->
unlock($tiledir);
exit 0;