
The $site_root parameter must be set in order for the file resource ensuring it to work. However, the best default for it depends on the $site_name and $site_vhosts_root parameter. Class parameter defaults behave strangely if they depend on another class parameter: they take on the value of whatever the user has set, not the default value. So if we want the default value of $site_root to be "${site_vhosts_root}/${site_name}", and we want it to be acceptable to use the default value of 'www.example.com' as the site name, then we have to set the default in the body of the class, not in the parameters list. The same is true for the $site_docroot parameter. This patch leaves the official default of $site_root as undef but conditionally sets a preferred default of "${site_vhosts_root}/${site_name}" in the body of the class. Since variables in puppet are immutable we need to assign this value to a new variable and fix the references to this variable throughout hte module. This patch changes the official default of $site_docroot from "${site_root}/w" to undef, because that default would have different behavior depending on whether the user had set $site_root or not. We then conditionally set it to the right default in the body of the class and update references to that variable. Also changed the Directory key for the docroot in the vhost template to refer to the $docroot parameter passed in to the httpd::vhost type rather than the $_site_docroot value from the class, which evaluates to the same value but makes the Directory tag consistent with the Docroot declaration above it. Change-Id: Iaed65b20816c0b4f6fd34f7e0ef07f906bb9750e
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
<?php
|
|
|
|
$aliases['<%= @site_alias %>'] = array(
|
|
'root' => '<%= @_site_docroot %>',
|
|
'dsd-root' => '<%= @_site_root %>',
|
|
'uri' => '<%= @site_base_url %>',
|
|
'db-url' => 'mysql://<%= @site_mysql_user %>:<%= @site_mysql_password %>@<%= @site_mysql_host %>/<%= @site_mysql_database %>',
|
|
'databases' => array(
|
|
'default' => array(
|
|
'driver' => 'mysql',
|
|
'username' => '<%= @site_mysql_user %>',
|
|
'password' => '<%= @site_mysql_password %>',
|
|
'port' => '',
|
|
'host' => '<%= @site_mysql_host %>',
|
|
'database' => '<%= @site_mysql_database %>',
|
|
),
|
|
),
|
|
'file-owner' => '<%= @site_file_owner %>',
|
|
'file-group' => 'www-data',
|
|
'variables' => array(
|
|
'site_name' => '<%= @site_name %>',
|
|
),
|
|
'profile' => '<%= @site_profile %>',
|
|
'default-admin-password' => '<%= @site_admin_password %>',
|
|
'disable-features-revert' => FALSE,
|
|
'package-provider' => 'drush-dl',
|
|
'package-repository' => '<%= @package_repository %>',
|
|
'package-dist-name' => 'groups',
|
|
<% if @package_branch == 'dev' %>
|
|
'package-dev-branch' => TRUE,
|
|
<% end %>
|
|
); |