From c5b5a619d7ff94a087067c337d912f481d44d9e7 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Sun, 26 Mar 2017 00:10:50 -0400 Subject: [PATCH] Remove most uses of concat() Concat returns a new rvalue instead of altering the existing array, which I had mistakenly thought was it's behaviour. Using more variables allows to join more elements together. This should fix nginx installations, and resolve possible issues with the untested debconf options. --- manifests/hostmaster.pp | 46 +++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/manifests/hostmaster.pp b/manifests/hostmaster.pp index 2f71716..7b3faaf 100644 --- a/manifests/hostmaster.pp +++ b/manifests/hostmaster.pp @@ -38,49 +38,59 @@ class aegir::hostmaster ( "${package_name}-hostmaster aegir/webserver select ${server}", ] if $email { - concat($debconf_settings, ["${package_name}-hostmaster aegir/email string ${email}"]) + $debconf_email = ["${package_name}-hostmaster aegir/email string ${email}"] + } + else { + $debconf_email = [] } if $makefile { - concat($debconf_settings, ["${package_name}-hostmaster aegir/makefile string ${makefile}"]) + $debconf_makefile = ["${package_name}-hostmaster aegir/makefile string ${makefile}"] + } + else { + $debconf_makefile = [] } if $working_copy { - concat($debconf_settings, ["${package_name}-hostmaster aegir/working-copy boolean true"]) + $debconf_working_copy = ["${package_name}-hostmaster aegir/working-copy boolean true"] + } + else { + $debconf_working_copy = [] } if $drush_version { - concat($debconf_settings, ["${package_name}-provision aegir/drush_version string ${drush_version}"]) + $debconf_drush = ["${package_name}-provision aegir/drush_version string ${drush_version}"] + } + else { + $debconf_drush = [] } file { '/etc/dpkg/aegir.response': ensure => 'file', - content => join($debconf_settings, "\n") + content => join( + concat( + $debconf_settings, $debconf_email, $debconf_makefile, + $debconf_working_copy, $debconf_drush), + "\n") } if ($server == 'nginx') { # Install nginx and phpX-fpm before running the aegir install. - $nginx_packages = ['nginx'] case $facts['os']['lsb']['distcodename'] { - 'wheezy', 'jessie': { concat($nginx_packages, ['php5-fpm']) } - default: { concat($nginx_packages, ['php7.0-fpm']) } + 'wheezy', 'jessie': { $php = ['php5-fpm'] } + default: { $php = ['php7.0-fpm'] } } ensure_packages( - $nginx_packages, + concat(['nginx'], $php), { 'ensure' => 'present', 'before' => Package['aegir'], } ) - $install_options = join($nginx_packages) - } - else { - $install_options = '' } # Pass in extra packages through install options for nginx support. # Even with aegir/webserver set in preconfig, apt-get tries to install # with phpX (not fpm). package { 'aegir': - ensure => 'installed', - name => $package_name, - responsefile => '/etc/dpkg/aegir.response', - install_options => $install_options, - require => [ + ensure => 'installed', + name => $package_name, + responsefile => '/etc/dpkg/aegir.response', + require => [ Apt::Source['aegir'], Class['apt::update'], File['/etc/dpkg/aegir.response']