From 4e4bdf5dbbd559c612b54c990fb8cec228b0548f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 7 Sep 2026 15:25:53 +0100 Subject: [PATCH] Replace manual unpacking with archive_file in tile cookbook --- .rubocop_todo.yml | 1 - cookbooks/tile/recipes/default.rb | 32 ++++++------------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 520a3b909..7346b2c85 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,7 +13,6 @@ Chef/Modernize/ExecuteArchiveExtract: - '**/attributes/*.rb' - '**/Berksfile' - 'cookbooks/overpass/recipes/default.rb' - - 'cookbooks/tile/recipes/default.rb' # Offense count: 1284 # This cop supports safe autocorrection (--autocorrect). diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index a9acb1c07..945e1c589 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -223,11 +223,7 @@ directory "/srv/tile.openstreetmap.org/data" do mode "755" end -package %w[ - mapnik-utils - tar - unzip -] +package "mapnik-utils" node[:tile][:data].each_value do |data| url = data[:url] @@ -245,27 +241,11 @@ node[:tile][:data].each_value do |data| directory = "/srv/tile.openstreetmap.org/data" end - if file =~ /\.tgz$/ - execute file do - action :nothing - command "tar -zxf #{file} -C #{directory}" - user "tile" - group "tile" - end - elsif file =~ /\.tar\.bz2$/ - execute file do - action :nothing - command "tar -jxf #{file} -C #{directory}" - user "tile" - group "tile" - end - elsif file =~ /\.zip$/ - execute file do - action :nothing - command "unzip -qq -o #{file} -d #{directory}" - user "tile" - group "tile" - end + archive_file file do + destination directory + owner "tile" + group "tile" + overwrite true end execute "#{file}_shapeindex" do -- 2.47.3