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.
This commit is contained in:
Kienan Stewart 2017-03-26 00:10:50 -04:00
parent 48eabf9dee
commit c5b5a619d7
1 changed files with 28 additions and 18 deletions

View File

@ -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']