From e3b6de2da2584b7b29d7aa7863a94dc965002802 Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Thu, 4 Apr 2013 14:02:58 +0400 Subject: [PATCH] Implement character_set. You can change the default server and client character set --- manifests/config.pp | 11 +++++++---- templates/my.cnf.erb | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 440246a..48c74a2 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -19,6 +19,8 @@ # [*default_engine] - configure a default table engine # [*root_group] - use specified group for root-owned files # [*restart] - whether to restart mysqld (true/false) +# [*character-set] - You can change the default server and +# client character set # # Actions: # @@ -52,15 +54,16 @@ class mysql::config( $default_engine = 'UNSET', $root_group = $mysql::params::root_group, $restart = $mysql::params::restart, - $purge_conf_dir = false + $purge_conf_dir = false, + $character_set = 'UNSET', ) inherits mysql::params { File { owner => 'root', group => $root_group, mode => '0400', - notify => $restart ? { - true => Exec['mysqld-restart'], + notify => $restart ? { + true => Exec['mysqld-restart'], false => undef, }, } @@ -100,7 +103,7 @@ class mysql::config( unless => "mysqladmin -u root -p'${root_password}' status > /dev/null", path => '/usr/local/sbin:/usr/bin:/usr/local/bin', notify => $restart ? { - true => Exec['mysqld-restart'], + true => Exec['mysqld-restart'], false => undef, }, require => File['/etc/mysql/conf.d'], diff --git a/templates/my.cnf.erb b/templates/my.cnf.erb index 8a764bc..be20133 100644 --- a/templates/my.cnf.erb +++ b/templates/my.cnf.erb @@ -1,6 +1,9 @@ [client] -port = <%= port %> +port = <%= port %> socket = <%= socket %> +<% if character_set != 'UNSET' %> +default-character-set = <%= character_set %> +<% end -%> [mysqld_safe] socket = <%= socket %> nice = 0 @@ -36,6 +39,9 @@ max_binlog_size = 100M <% if default_engine != 'UNSET' %> default-storage-engine = <%= default_engine %> <% end %> +<% if character_set != 'UNSET' %> +character-set-server = <%= character_set %> +<% end %> <% if ssl == true %> ssl-ca = <%= ssl_ca %> ssl-cert = <%= ssl_cert %>