Use multipackage installs throughout
authorTim Smith <tsmith@chef.io>
Wed, 15 Nov 2017 23:14:53 +0000 (15:14 -0800)
committerTom Hughes <tom@compton.nu>
Thu, 16 Nov 2017 08:49:53 +0000 (08:49 +0000)
In Chef 12.1 we introduced multipackage installs. Instead of shelling
out to dpkg for each package to determine what we should do we gather
the information we need and check each package in the array. It's faster
and it takes less memory. It's especially useful after the first run when
nothing actually changes. Far fewer resources consumed.

I noticed you arranged the packages so I tried to keep them to that
same arrangement and I used multiline arrays since they make the diffs
nicer in the future as you add / remove packages. This isn't necessary
for Chef 13, but it's best practice.

Signed-off-by: Tim Smith <tsmith@chef.io>
Closes #137

30 files changed:
cookbooks/accounts/recipes/default.rb
cookbooks/apache/recipes/default.rb
cookbooks/apt/recipes/default.rb
cookbooks/backup/recipes/default.rb
cookbooks/blogs/recipes/default.rb
cookbooks/clamav/recipes/default.rb
cookbooks/dev/recipes/default.rb
cookbooks/dns/recipes/default.rb
cookbooks/donate/recipes/default.rb
cookbooks/elasticsearch/recipes/default.rb
cookbooks/exim/recipes/default.rb
cookbooks/forum/recipes/default.rb
cookbooks/foundation/recipes/owg.rb
cookbooks/geodns/recipes/default.rb
cookbooks/gps-tile/recipes/default.rb
cookbooks/imagery/recipes/default.rb
cookbooks/letsencrypt/recipes/default.rb
cookbooks/logstash/recipes/default.rb
cookbooks/mediawiki/recipes/default.rb
cookbooks/ntp/recipes/default.rb
cookbooks/sysctl/recipes/default.rb
cookbooks/taginfo/recipes/default.rb
cookbooks/tile/recipes/default.rb
cookbooks/tilecache/recipes/default.rb
cookbooks/tilelog/recipes/default.rb
cookbooks/tools/recipes/default.rb
cookbooks/trac/recipes/default.rb
cookbooks/web/recipes/gpx.rb
cookbooks/wordpress/recipes/default.rb
cookbooks/yournavigation/recipes/default.rb

index feb57a5e99fc845f9feb065b64c8c6ed8e234b4f..b0110cf3ced32284ee8414d4008c1a6c9a4dd9cc 100644 (file)
@@ -17,9 +17,7 @@
 # limitations under the License.
 #
 
-package "zsh" do
-  action :install
-end
+package "zsh"
 
 administrators = []
 
index 1a274e223b5e9605ea3fdca115a4a38884310029..625c3eb22c110bb6e9afb2a787a3de927e619a2b 100644 (file)
 
 include_recipe "ssl"
 
-package "apache2"
-package "libwww-perl"
+package %w[
+  apache2
+  libwww-perl
+]
 
 %w[event itk prefork worker].each do |mpm|
   if mpm == node[:apache][:mpm]
index 1de8cffe24d6b36d9d85859cc248b73718f9c032..508030bf2bde17d743004aba693cd58783d51255 100644 (file)
 # limitations under the License.
 #
 
-package "apt"
-package "gnupg-curl"
-package "update-notifier-common"
+package %w[
+  apt
+  gnupg-curl
+  update-notifier-common
+]
 
 file "/etc/motd.tail" do
   action :delete
index 27d12eb9bbf5cf2d634f30d7bfb55fece0b99315..268eaeec881ff481a059a6ef15bef392ec78f827 100644 (file)
 # limitations under the License.
 #
 
-package "perl"
-package "libdate-calc-perl"
+package %w[
+  perl
+  libdate-calc-perl
+]
 
 directory "/store/backup" do
   owner "osmbackup"
index faf12775c9bc848c1e63f823552b985784cbf1f3..e6771663864d4403002e27af52e403bb6b67387e 100644 (file)
 include_recipe "apache"
 include_recipe "git"
 
-package "ruby"
-package "ruby-dev"
-package "make"
-package "gcc"
-package "libsqlite3-dev"
+package %w[
+  ruby
+  ruby-dev
+  make
+  gcc
+  libsqlite3-dev
+]
 
 gem_package "bundler"
 
index fe92becb5002b6f73a6f296633fd59ef938a7570..93ec86e6903c702e9adbf8619dd71576eadb7836 100644 (file)
 # limitations under the License.
 #
 
-package "clamav-daemon"
-package "clamav-freshclam"
-package "clamav-unofficial-sigs"
+package %w[
+  clamav-daemon
+  clamav-freshclam
+  clamav-unofficial-sigs
+]
 
 template "/etc/clamav-unofficial-sigs.conf.d/50-chef.conf" do
   source "clamav-unofficial-sigs.conf.erb"
index 80b80586b419a0c31be19ac6f1a662e8952c98d5..c1c56e8cffe3d675ba837a7df89b0adb55dd4f9a 100644 (file)
@@ -28,30 +28,36 @@ include_recipe "nodejs"
 include_recipe "postgresql"
 include_recipe "python"
 
-package "php"
-package "php-cgi"
-package "php-cli"
-package "php-curl"
-package "php-db"
-package "php-fpm"
-package "php-imagick"
-package "php-mcrypt"
-package "php-mysql"
-package "php-pear"
-package "php-pgsql"
-package "php-sqlite3"
-
-package "pngcrush"
-package "pngquant"
-
-package "python"
-package "python-argparse"
-package "python-beautifulsoup"
-package "python-cheetah"
-package "python-dateutil"
-package "python-magic"
-package "python-psycopg2"
-package "python-gdal"
+package %w[
+  php
+  php-cgi
+  php-cli
+  php-curl
+  php-db
+  php-fpm
+  php-imagick
+  php-mcrypt
+  php-mysql
+  php-pear
+  php-pgsql
+  php-sqlite3
+]
+
+package %w[
+  pngcrush
+  pngquant
+]
+
+package %w[
+  python
+  python-argparse
+  python-beautifulsoup
+  python-cheetah
+  python-dateutil
+  python-magic
+  python-psycopg2
+  python-gdal
+]
 
 nodejs_package "svgo"
 
index 6c19048f20aa5d747a4f0813c74171a1669efa69..33ec30277186e3e1aac83ff066ac20f729672b8f 100644 (file)
@@ -22,14 +22,15 @@ include_recipe "apache"
 
 passwords = data_bag_item("dns", "passwords")
 
-package "make"
-
-package "perl"
-package "libxml-treebuilder-perl"
-package "libxml-writer-perl"
-package "libyaml-perl"
-package "libwww-perl"
-package "libjson-xs-perl"
+package %w[
+  make
+  perl
+  libxml-treebuilder-perl
+  libxml-writer-perl
+  libyaml-perl
+  libwww-perl
+  libjson-xs-perl
+]
 
 directory "/srv/dns.openstreetmap.org" do
   owner "root"
index 89eb26d57462d16fcd03b74deed59d22b8df5621..1e056d96e403e8fc88b7904bb54be649a4934bde 100644 (file)
@@ -21,11 +21,13 @@ include_recipe "apache"
 include_recipe "mysql"
 include_recipe "git"
 
-package "php"
-package "php-cli"
-package "php-curl"
-package "php-mysql"
-package "php-gd"
+package %w[
+  php
+  php-cli
+  php-curl
+  php-mysql
+  php-gd
+]
 
 apache_module "php7.0"
 
index a40d45ce22bf58d3125121f8f76decb07e855800..36858b77de1ce36e76975a90a6af9846d7a7d5e0 100644 (file)
 # limitations under the License.
 #
 
-package "default-jre-headless"
-package "elasticsearch"
+package %w[
+  default-jre-headless
+  elasticsearch
+]
 
 template "/etc/elasticsearch/elasticsearch.yml" do
   source "elasticsearch.yml.erb"
index a74e4d6a508693c77a71b7ef0df74537a6a55ab4..144b62bb37b1ca6194fa473e4ef289407be1cc2a 100644 (file)
 
 include_recipe "networking"
 
-package "exim4"
-package "openssl"
-package "ssl-cert"
+package %w[
+  exim4
+  openssl
+  ssl-cert
+]
 
 package "exim4-daemon-heavy" if File.exist?("/var/run/clamav/clamd.ctl")
 
index e6f131113298220a301031cc0396cac0e3308222..fcc776620a26bd99e936f90428059a0ba1fc5abc 100644 (file)
@@ -22,11 +22,13 @@ include_recipe "mysql"
 
 passwords = data_bag_item("forum", "passwords")
 
-package "php"
-package "php-cli"
-package "php-mysql"
-package "php-xml"
-package "php-apcu"
+package %w[
+  php
+  php-cli
+  php-mysql
+  php-xml
+  php-apcu
+]
 
 apache_module "php7.0"
 apache_module "rewrite"
index d0dd92a843b4e4d2a2222d90b309053cb665c767..3e0df09bbb5e7e56aba12bba3b24e190452c644b 100644 (file)
 include_recipe "apache"
 include_recipe "git"
 
-package "ruby"
-package "ruby-dev"
+package %w[
+  ruby
+  ruby-dev
+]
 
 gem_package "bundler"
 
index a0ee24646fe42e075b1555d43bacc7e1eb35ecf9..a21323026f70f0f1ca59cba25d9908db735c23c7 100644 (file)
 # limitations under the License.
 #
 
-package "geoip-database-contrib"
-
-package "gdnsd"
+package %w[
+  geoip-database-contrib
+  gdnsd
+]
 
 service "gdnsd" do
   action [:enable, :start]
index f2104bc46136775c00926873c0a3113560ec5fc0..315865ac924cb7073fa4ebf534a12ebfae39d490 100644 (file)
 
 include_recipe "apache"
 
-package "make"
-package "build-essential"
-package "pkg-config"
-package "zlib1g-dev"
-package "libbz2-dev"
-package "libarchive-dev"
-package "libexpat1-dev"
-package "libpng-dev"
-package "pngquant"
-package "libcache-memcached-perl"
+package %w[
+  make
+  build-essential
+  pkg-config
+  zlib1g-dev
+  libbz2-dev
+  libarchive-dev
+  libexpat1-dev
+  libpng-dev
+  pngquant
+  libcache-memcached-perl
+]
 
 directory "/srv/gps-tile.openstreetmap.org" do
   owner "gpstile"
index 5a8e5517dfcc62b8bae3bad71786cf7985bf8b4a..814c2258242f94b1c5d62f130d4641725764412c 100644 (file)
@@ -21,24 +21,32 @@ include_recipe "nginx"
 include_recipe "git"
 
 # Imagery gdal Requirements
-package "gdal-bin"
-package "python-gdal"
+package %w[
+  gdal-bin
+  python-gdal
+]
 
 # Imagery MapServer + Mapcache Requirements
-package "cgi-mapserver"
-package "mapcache-cgi"
-package "mapcache-tools"
+package %w[
+  cgi-mapserver
+  mapcache-cgi
+  mapcache-tools
+]
 
 # Mapserver via Nginx requires as fastcgi spawner
-package "spawn-fcgi"
-package "multiwatch"
+package %w[
+  spawn-fcgi
+  multiwatch
+]
 
 # Imagery processing Requirements
 package "imagemagick"
 
 # Imagery misc compression
-package "xz-utils"
-package "unzip"
+package %w[
+  xz-utils
+  unzip
+]
 
 directory "/srv/imagery/mapserver" do
   owner "root"
index f3ddd9712ccacb66138d9a1db91624a7dc5eaffc..8f9564457835e4857aa6e265c545ddcd37e27bbf 100644 (file)
@@ -21,8 +21,10 @@ include_recipe "apache"
 
 keys = data_bag_item("chef", "keys")
 
-package "certbot"
-package "ruby"
+package %w[
+  certbot
+  ruby
+]
 
 directory "/etc/letsencrypt" do
   owner "letsencrypt"
index 3f2c98f91165cf1db973af63e27794d37cf2f5ad..fd758d8802237bc0bf9d8baae3599bd20c05a334 100644 (file)
@@ -21,8 +21,10 @@ include_recipe "networking"
 
 keys = data_bag_item("logstash", "keys")
 
-package "default-jre-headless"
-package "logstash"
+package %w[
+  default-jre-headless
+  logstash
+]
 
 cookbook_file "/var/lib/logstash/lumberjack.crt" do
   source "lumberjack.crt"
index 9dedef7cf50ffa4bcc2eeba9d359280ed0dc8720..568ca2d72d6a0742542eb2342148c316b510e0e5 100644 (file)
@@ -23,33 +23,43 @@ include_recipe "mysql"
 include_recipe "git"
 
 # Mediawiki Base Requirements
-package "php"
-package "php-cli"
-package "php-curl"
-package "php-gd"
-package "php-intl"
-package "php-mbstring"
-package "php-mysql"
-package "php-xml"
+package %w[
+  php
+  php-cli
+  php-curl
+  php-gd
+  php-intl
+  php-mbstring
+  php-mysql
+  php-xml
+]
 
 # Mediawiki enhanced difference engine
 package "php-wikidiff2"
 
 # Mediawiki Image + SVG support
-package "imagemagick"
-package "librsvg2-bin"
+package %w[
+  imagemagick
+  librsvg2-bin
+]
 
 # Mediawiki PDF support via Extension:PdfHandler
-package "ghostscript"
-package "poppler-utils"
+package %w[
+  ghostscript
+  poppler-utils
+]
 
 # Mediawiki backup
-package "xz-utils"
-package "liblz4-tool"
+package %w[
+  xz-utils
+  liblz4-tool
+]
 
 # Mediawiki packages for VisualEditor support
-package "curl"
-package "parsoid"
+package %w[
+  curl
+  parsoid
+]
 
 # Mediawiki packages for SyntaxHighight support
 package "python-pygments"
index cdf3b5a96ae4bafa892ddc19b1b772b026efe835..ef5b328b311122442b9f0bb2d1ee3ab7bab716cd 100644 (file)
 
 require "socket"
 
-package "ntp"
-package "ntpdate"
-package "tzdata"
+package %w[
+  ntp
+  ntpdate
+  tzdata
+]
 
 execute "dpkg-reconfigure-tzdata" do
   action :nothing
index 930541945ab44c44b04e832044355a4158ba630b..de6cdcbf5b6a7130b93ce659f54b2cee024c01ac 100644 (file)
@@ -17,9 +17,7 @@
 # limitations under the License.
 #
 
-package "procps" do
-  action :install
-end
+package "procps"
 
 directory "/etc/sysctl.d" do
   owner "root"
index e1a9c722588901dfddb8ee73ce85708cd749ce39..50528eae7feeccdc2443c5e360d9ddc170c47b3a 100644 (file)
@@ -23,23 +23,27 @@ include_recipe "apache"
 include_recipe "passenger"
 include_recipe "git"
 
-package "libsqlite3-dev"
-package "zlib1g-dev"
-package "libbz2-dev"
-package "libboost-dev"
-package "libexpat1-dev"
-package "libsparsehash-dev"
-package "libgd2-xpm-dev"
-package "libicu-dev"
-package "libboost-program-options-dev"
-package "cmake"
-package "make"
-package "g++"
-
-package "sqlite3"
-package "osmosis"
-package "curl"
-package "pbzip2"
+package %w[
+  libsqlite3-dev
+  zlib1g-dev
+  libbz2-dev
+  libboost-dev
+  libexpat1-dev
+  libsparsehash-dev
+  libgd2-xpm-dev
+  libicu-dev
+  libboost-program-options-dev
+  cmake
+  make
+  g++
+]
+
+package %w[
+  sqlite3
+  osmosis
+  curl
+  pbzip2
+]
 
 ruby_version = node[:passenger][:ruby_version]
 
index 9ae3dfc93367f9693fafb03f5e26d25a5be880a5..7befcdc20980b77fde84a9e8a3a18cd4d3829a11 100644 (file)
@@ -118,17 +118,21 @@ template "/srv/tile.openstreetmap.org/html/index.html" do
   mode 0o644
 end
 
-package "python-cairo"
-package "python-mapnik"
-package "python-setuptools"
+package %w[
+  python-cairo
+  python-mapnik
+  python-setuptools
+]
 
 python_package "pyotp"
 
-package "fonts-noto-cjk"
-package "fonts-noto-hinted"
-package "fonts-noto-unhinted"
-package "fonts-hanazono"
-package "ttf-unifont"
+package %w[
+  fonts-noto-cjk
+  fonts-noto-hinted
+  fonts-noto-unhinted
+  fonts-hanazono
+  ttf-unifont
+]
 
 ["NotoSansArabicUI-Regular.ttf", "NotoSansArabicUI-Bold.ttf"].each do |font|
   remote_file "/usr/share/fonts/truetype/noto/#{font}" do
@@ -421,14 +425,20 @@ directory "/var/log/tile" do
   mode 0o755
 end
 
-package "osm2pgsql"
-package "osmosis"
+package %w[
+  osm2pgsql
+  osmosis
+]
 
-package "ruby"
-package "ruby-dev"
+package %w[
+  ruby
+  ruby-dev
+]
 
-package "libproj-dev"
-package "libxml2-dev"
+package %w[
+  libproj-dev
+  libxml2-dev
+]
 
 gem_package "proj4rb"
 gem_package "libxml-ruby"
index 0a02e1567edfac8c19ce52df47e44b55b724685d..728d26f49a9ba54206e2f3919b5f31e3485fab56 100644 (file)
@@ -27,8 +27,10 @@ package "apache2" do
   action :remove
 end
 
-package "xz-utils"
-package "openssl"
+package %w[
+  xz-utils
+  openssl
+]
 
 # oathtool for QoS token
 package "oathtool"
index 675e3abc2ca6c26915c037e377b4bf9932a394b4..0916f6b6038d724d89917008300ea605ea20d090 100644 (file)
 
 include_recipe "tools"
 
-package "gcc"
-package "make"
-package "autoconf"
-package "automake"
-package "libboost-filesystem-dev"
-package "libboost-system-dev"
-package "libboost-program-options-dev"
+package %w[
+  gcc
+  make
+  autoconf
+  automake
+  libboost-filesystem-dev
+  libboost-system-dev
+  libboost-program-options-dev
+]
 
 tilelog_source_directory = node[:tilelog][:source_directory]
 tilelog_input_directory = node[:tilelog][:input_directory]
index 5c872d9096265d6ccde1aaf555678154ffadd773..99c03e2b9d5992f80070be94b9d0b8857b6cc3c3 100644 (file)
 # limitations under the License.
 #
 
-package "bash-completion"
-package "dmidecode"
-package "ethtool"
-package "lsof"
-package "lsscsi"
-package "pciutils"
-package "screen"
-package "smartmontools"
-package "strace"
-package "sysstat"
-package "tcpdump"
-package "usbutils"
-package "numactl"
-package "xfsprogs"
-package "sysv-rc-conf"
-package "iotop"
-package "lvm2"
-package "rsyslog"
+package %w[
+  bash-completion
+  dmidecode
+  ethtool
+  lsof
+  lsscsi
+  pciutils
+  screen
+  smartmontools
+  strace
+  sysstat
+  tcpdump
+  usbutils
+  numactl
+  xfsprogs
+  sysv-rc-conf
+  iotop
+  lvm2
+  rsyslog
+]
 
 service "rsyslog" do
   action [:enable, :start]
index b149a5751cfa7ac6c620b857bbd9d15141a659f8..a26cc7d27319efc27d9c2540bee6768e80893783 100644 (file)
 
 include_recipe "apache"
 
-package "trac"
-package "trac-git"
-package "ruby"
+package %w[
+  trac
+  trac-git
+  ruby
+]
 
 site_name = "trac.openstreetmap.org"
 site_directory = "/srv/#{site_name}"
index 59d5bc1de684cf3d65a56f870052ef34743fb9cf..4a1da30b2b05405977be968b98fef72fd68eb466 100644 (file)
@@ -21,16 +21,18 @@ include_recipe "web::base"
 
 db_passwords = data_bag_item("db", "passwords")
 
-package "gcc"
-package "make"
-package "pkg-config"
-package "libarchive-dev"
-package "libbz2-dev"
-package "libexpat1-dev"
-package "libgd2-noxpm-dev"
-package "libmemcached-dev"
-package "libpq-dev"
-package "zlib1g-dev"
+package %w[
+  gcc
+  make
+  pkg-config
+  libarchive-dev
+  libbz2-dev
+  libexpat1-dev
+  libgd2-noxpm-dev
+  libmemcached-dev
+  libpq-dev
+  zlib1g-dev
+]
 
 gpx_directory = "#{node[:web][:base_directory]}/gpx-import"
 pid_directory = node[:web][:pid_directory]
index a694f42b2a5b1f28b287d4a8c78e2c517257ba5d..9c9bc7213e8ccc7935efedbfbd71b39bf7f1f26e 100644 (file)
 include_recipe "apache"
 include_recipe "mysql"
 
-package "subversion"
-
-package "php"
-package "php-mysql"
+package %w[
+  subversion
+  php
+  php-mysql
+]
 
 apache_module "php7.0"
 apache_module "rewrite"
index 949637b58a38b23bd007750f122de7e4e41ef68f..f9d5e2a39de09fd6287d71e24a8d1fac8c9e91a7 100644 (file)
 
 include_recipe "apache"
 
-package "php"
-package "php-cli"
-package "php-apcu"
+package %w[
+  php
+  php-cli
+  php-apcu
+]
 
 # Required for osmosis
 package "default-jre-headless"
 
 # Required for building gosmore
-package "build-essential"
-package "libxml2-dev"
-package "libgtk2.0-dev"
-package "subversion"
-package "libcurl4-gnutls-dev"
-package "libgps-dev"
-package "libcurl3"
-package "buffer"
-package "git"
-package "cmake"
-package "libqt4-dev"
-package "qt4-dev-tools"
-package "qt4-linguist-tools"
-package "libicu-dev"
+package %w[
+  build-essential
+  libxml2-dev
+  libgtk2.0-dev
+  subversion
+  libcurl4-gnutls-dev
+  libgps-dev
+  libcurl3
+  buffer
+  git
+  cmake
+  libqt4-dev
+  qt4-dev-tools
+  qt4-linguist-tools
+  libicu-dev
+]
 
 apache_module "php7.0"