Fix mysql parameter defaults

If the user wants to create a drupal database, the username, password,
and database name must be set. This patch sets reasonable defaults for
$mysql_user and $mysql_database, and causes the catalog to fail if the
user does not provide $mysql_password, but only if
$site_create_database is set.

Change-Id: I829ebb1543d4733875dba3da5e900ae1ad6d64dc
This commit is contained in:
Colleen Murphy 2015-10-15 13:17:54 -07:00
parent 601a5cf31f
commit 2b25312530
1 changed files with 5 additions and 2 deletions

View File

@ -66,9 +66,9 @@ class drupal (
$site_root = undef,
$site_docroot = undef,
$site_mysql_host = 'localhost',
$site_mysql_user = undef,
$site_mysql_user = 'drupal',
$site_mysql_password = undef,
$site_mysql_database = undef,
$site_mysql_database = 'drupal',
$site_profile = 'standard',
$site_admin_password = undef,
$site_alias = undef,
@ -207,6 +207,9 @@ class drupal (
# site mysql database
if $site_create_database == true {
if $site_mysql_password == undef {
fail('You must set $site_mysql_password when $site_create_database is true.')
}
mysql::db { $site_mysql_database:
user => $site_mysql_user,
password => $site_mysql_password,