diff --git a/manifests/config.pp b/manifests/config.pp index 2e73dca..2274f37 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -43,7 +43,8 @@ class mysql::config( $ssl_ca = $mysql::params::ssl_ca, $ssl_cert = $mysql::params::ssl_cert, $ssl_key = $mysql::params::ssl_key, - $log_error = $mysql::params::log_error + $log_error = $mysql::params::log_error, + $default_engine = 'UNSET' ) inherits mysql::params { File { diff --git a/spec/classes/mysql_config_spec.rb b/spec/classes/mysql_config_spec.rb index e27287f..39c07f1 100644 --- a/spec/classes/mysql_config_spec.rb +++ b/spec/classes/mysql_config_spec.rb @@ -9,6 +9,7 @@ describe 'mysql::config' do :port => '3306', :etc_root_password => false, :datadir => '/var/lib/mysql', + :default_engine => 'UNSET', :ssl => false, :ssl_ca => '/etc/mysql/cacert.pem', :ssl_cert => '/etc/mysql/server-cert.pem', @@ -74,17 +75,18 @@ describe 'mysql::config' do [ {}, { - :service_name => 'dans_service', - :config_file => '/home/dan/mysql.conf', - :service_name => 'dans_mysql', - :socket => '/home/dan/mysql.sock', - :bind_address => '0.0.0.0', - :port => '3306', - :datadir => '/path/to/datadir', - :ssl => true, - :ssl_ca => '/path/to/cacert.pem', - :ssl_cert => '/path/to/server-cert.pem', - :ssl_key => '/path/to/server-key.pem' + :service_name => 'dans_service', + :config_file => '/home/dan/mysql.conf', + :service_name => 'dans_mysql', + :socket => '/home/dan/mysql.sock', + :bind_address => '0.0.0.0', + :port => '3306', + :datadir => '/path/to/datadir', + :default_engine => 'InnoDB', + :ssl => true, + :ssl_ca => '/path/to/cacert.pem', + :ssl_cert => '/path/to/server-cert.pem', + :ssl_key => '/path/to/server-key.pem' } ].each do |passed_params| @@ -140,6 +142,9 @@ describe 'mysql::config' do "datadir = #{param_values[:datadir]}", "bind-address = #{param_values[:bind_address]}" ] + if param_values[:default_engine] != 'UNSET' + expected_lines = expected_lines | [ "default-storage-engine = #{param_values[:default_engine]}" ] + end if param_values[:ssl] expected_lines = expected_lines | [ diff --git a/templates/my.cnf.erb b/templates/my.cnf.erb index 714bd37..5e434ae 100644 --- a/templates/my.cnf.erb +++ b/templates/my.cnf.erb @@ -23,7 +23,9 @@ query_cache_size = 16M log_error = <%= log_error %> expire_logs_days = 10 max_binlog_size = 100M - +<% if default_engine != 'UNSET' %> +default-storage-engine = <%= default_engine %> +<% end %> <% if ssl == true %> ssl-ca = <%= ssl_ca %> ssl-cert = <%= ssl_cert %>