Merge pull request #132 from Savar/manage_config_file_parameter

handling of my.cnf config file is now optional
This commit is contained in:
Ashley Penney 2013-07-02 08:59:44 -07:00
commit 9839a1ccae
3 changed files with 28 additions and 4 deletions

View file

@ -8,6 +8,7 @@
# [*default_engine] - configure a default table engine # [*default_engine] - configure a default table engine
# [*etc_root_password*] - whether to save /etc/my.cnf. # [*etc_root_password*] - whether to save /etc/my.cnf.
# [*log_error] - path to mysql error log # [*log_error] - path to mysql error log
# [*manage_config_file*] - if the config file should be managed (default: true)
# [*max_allowed_packet*] - Maximum network packet size mysqld will accept # [*max_allowed_packet*] - Maximum network packet size mysqld will accept
# [*old_root_password*] - previous root user password, # [*old_root_password*] - previous root user password,
# [*port*] - port to bind service. # [*port*] - port to bind service.
@ -42,6 +43,7 @@ class mysql::config(
$tmpdir = $mysql::tmpdir, $tmpdir = $mysql::tmpdir,
$default_engine = $mysql::default_engine, $default_engine = $mysql::default_engine,
$etc_root_password = $mysql::etc_root_password, $etc_root_password = $mysql::etc_root_password,
$manage_config_file = $mysql::manage_config_file,
$max_allowed_packet = $mysql::max_allowed_packet, $max_allowed_packet = $mysql::max_allowed_packet,
$log_error = $mysql::log_error, $log_error = $mysql::log_error,
$pidfile = $mysql::pidfile, $pidfile = $mysql::pidfile,
@ -131,15 +133,18 @@ class mysql::config(
ensure => directory, ensure => directory,
mode => '0755', mode => '0755',
} }
file { '/etc/mysql/conf.d': file { '/etc/mysql/conf.d':
ensure => directory, ensure => directory,
mode => '0755', mode => '0755',
recurse => $purge_conf_dir, recurse => $purge_conf_dir,
purge => $purge_conf_dir, purge => $purge_conf_dir,
} }
file { $config_file:
content => template('mysql/my.cnf.erb'),
mode => '0644',
}
if $manage_config_file {
file { $config_file:
content => template('mysql/my.cnf.erb'),
mode => '0644',
}
}
} }

View file

@ -26,6 +26,8 @@
# #
# [*log_error*] - Where to log errors # [*log_error*] - Where to log errors
# #
# [*manage_config_file*] - if the config file should be managed (default: true)
#
# [*manage_service*] - Boolean dictating if mysql::server should manage the service # [*manage_service*] - Boolean dictating if mysql::server should manage the service
# #
# [*max_allowed_packet*] - Maximum network packet size mysqld will accept # [*max_allowed_packet*] - Maximum network packet size mysqld will accept
@ -93,6 +95,7 @@ class mysql(
$etc_root_password = $mysql::params::etc_root_password, $etc_root_password = $mysql::params::etc_root_password,
$java_package_name = $mysql::params::java_package_name, $java_package_name = $mysql::params::java_package_name,
$log_error = $mysql::params::log_error, $log_error = $mysql::params::log_error,
$manage_config_file = true,
$manage_service = $mysql::params::manage_service, $manage_service = $mysql::params::manage_service,
$max_allowed_packet = $mysql::params::max_allowed_packet, $max_allowed_packet = $mysql::params::max_allowed_packet,
$old_root_password = $mysql::params::old_root_password, $old_root_password = $mysql::params::old_root_password,

View file

@ -56,6 +56,22 @@ describe 'mysql::config' do
{:osfamily => osfamily} {:osfamily => osfamily}
end end
describe 'when config file should be managed' do
let :params do
{:manage_config_file => true}
end
it { should contain_file(osparams[:config_file]) }
end
describe 'when config file should not be managed' do
let :params do
{:manage_config_file => false}
end
it { should_not contain_file(osparams[:config_file]) }
end
describe 'when root password is set' do describe 'when root password is set' do
let :params do let :params do