From: Tom Hughes Date: Sat, 9 Jan 2016 14:39:32 +0000 (+0000) Subject: Avoid errors cleaning up assets for older rails trees X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/30aaefa474d61463d99b637f9a998263dc364830 Avoid errors cleaning up assets for older rails trees --- diff --git a/cookbooks/web/templates/default/cleanup-assets.erb b/cookbooks/web/templates/default/cleanup-assets.erb index 132c8260a..175ce8b97 100644 --- a/cookbooks/web/templates/default/cleanup-assets.erb +++ b/cookbooks/web/templates/default/cleanup-assets.erb @@ -3,6 +3,7 @@ use strict; use warnings; +use Errno; use IO::Dir; use IO::File; use JSON::XS; @@ -13,17 +14,17 @@ my $manifest; if (my $file = IO::File->new("${root}/tmp/manifest.json", "r")) { - $manifest = decode_json(join("\n", $file->getlines)); + my $manifest = decode_json(join("\n", $file->getlines)); $file->close; + + expire_assets($manifest, "${root}/public/assets", ""); } else { - die "Can't open ${root}/tmp/manifest.json: $!"; + die "Can't open ${root}/tmp/manifest.json: $!" unless $!{ENOENT}; } -expire_assets($manifest, "${root}/public/assets", ""); - exit 0; sub expire_assets