From: Tom Hughes Date: Wed, 20 Feb 2019 21:33:42 +0000 (+0000) Subject: Allow planet redirector to handle any links under the webroot X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/993d0e674e027829dcf21005b38b9a9a1790a6ce?ds=inline Allow planet redirector to handle any links under the webroot --- diff --git a/cookbooks/planet/templates/default/apache-latest-planet-filename.erb b/cookbooks/planet/templates/default/apache-latest-planet-filename.erb index d7c8695c7..967fa41e5 100644 --- a/cookbooks/planet/templates/default/apache-latest-planet-filename.erb +++ b/cookbooks/planet/templates/default/apache-latest-planet-filename.erb @@ -2,9 +2,25 @@ # DO NOT EDIT - This file is being maintained by Chef +use strict; +use warnings; + +use Cwd qw(abs_path); + $| = 1; -while () { - my $where = readlink("<%= node[:planet][:dump][:xml_directory] %>/planet-latest.osm.bz2"); - s/planet\/planet\-latest\.osm\.bz2/planet\/$where/g; - print $_; + +while (my $path = ) +{ + chomp $path; + + my $file = abs_path("/store/planet${path}"); + + if ($file && $file =~ m|/store/planet/| && -f $file) + { + print "${file}\n"; + } + else + { + print "NULL\n"; + } }