From 6869b77541dc3b465a73aed23fb73776fc86716f Mon Sep 17 00:00:00 2001 From: Eugene Kirpichov Date: Tue, 21 Aug 2012 18:09:48 -0700 Subject: [PATCH] Parameterized pidfile; critical for successful first restart --- manifests/config.pp | 1 + manifests/params.pp | 3 +++ spec/classes/mysql_config_spec.rb | 5 +++++ spec/fixtures/manifests/site.pp | 0 templates/my.cnf.erb | 1 + 5 files changed, 10 insertions(+) delete mode 100644 spec/fixtures/manifests/site.pp diff --git a/manifests/config.pp b/manifests/config.pp index c3b446c..fc68214 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -38,6 +38,7 @@ class mysql::config( $service_name = $mysql::params::service_name, $config_file = $mysql::params::config_file, $socket = $mysql::params::socket, + $pidfile = $mysql::params::pidfile, $datadir = $mysql::params::datadir, $ssl = $mysql::params::ssl, $ssl_ca = $mysql::params::ssl_ca, diff --git a/manifests/params.pp b/manifests/params.pp index 1c438ff..b9791a4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -34,6 +34,7 @@ class mysql::params { $client_package_name = 'mysql' $server_package_name = 'mysql-server' $socket = '/var/lib/mysql/mysql.sock' + $pidfile = '/var/run/mysqld/mysqld.pid' $config_file = '/etc/my.cnf' $log_error = '/var/log/mysqld.log' $ruby_package_name = 'ruby-mysql' @@ -53,6 +54,7 @@ class mysql::params { $client_package_name = 'mysql-client' $server_package_name = 'mysql-server' $socket = '/var/run/mysqld/mysqld.sock' + $pidfile = '/var/run/mysqld/mysqld.pid' $config_file = '/etc/mysql/my.cnf' $log_error = '/var/log/mysql/error.log' $ruby_package_name = 'libmysql-ruby' @@ -71,6 +73,7 @@ class mysql::params { $client_package_name = 'databases/mysql55-client' $server_package_name = 'databases/mysql55-server' $socket = '/tmp/mysql.sock' + $pidfile = '/var/db/mysql/mysql.pid' $config_file = '/var/db/mysql/my.cnf' $log_error = "/var/db/mysql/${::hostname}.err" $ruby_package_name = 'ruby-mysql' diff --git a/spec/classes/mysql_config_spec.rb b/spec/classes/mysql_config_spec.rb index dd3364f..fab8899 100644 --- a/spec/classes/mysql_config_spec.rb +++ b/spec/classes/mysql_config_spec.rb @@ -21,6 +21,7 @@ describe 'mysql::config' do :service_name => 'mysql', :config_file => '/etc/mysql/my.cnf', :socket => '/var/run/mysqld/mysqld.sock', + :pidfile => '/var/run/mysqld/mysqld.pid', :root_group => 'root', :ssl_ca => '/etc/mysql/cacert.pem', :ssl_cert => '/etc/mysql/server-cert.pem', @@ -31,6 +32,7 @@ describe 'mysql::config' do :service_name => 'mysql-server', :config_file => '/var/db/mysql/my.cnf', :socket => '/tmp/mysql.sock', + :pidfile => '/var/db/mysql/mysql.pid', :root_group => 'wheel', }, 'Redhat' => { @@ -38,6 +40,7 @@ describe 'mysql::config' do :service_name => 'mysqld', :config_file => '/etc/my.cnf', :socket => '/var/lib/mysql/mysql.sock', + :pidfile => '/var/run/mysqld/mysqld.pid', :root_group => 'root', :ssl_ca => '/etc/mysql/cacert.pem', :ssl_cert => '/etc/mysql/server-cert.pem', @@ -92,6 +95,7 @@ describe 'mysql::config' do :service_name => 'dans_service', :config_file => '/home/dan/mysql.conf', :service_name => 'dans_mysql', + :pidfile => '/home/dan/mysql.pid', :socket => '/home/dan/mysql.sock', :bind_address => '0.0.0.0', :port => '3306', @@ -153,6 +157,7 @@ describe 'mysql::config' do expected_lines = [ "port = #{param_values[:port]}", "socket = #{param_values[:socket]}", + "pid-file = #{param_values[:pidfile]}", "datadir = #{param_values[:datadir]}", "bind-address = #{param_values[:bind_address]}" ] diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp deleted file mode 100644 index e69de29..0000000 diff --git a/templates/my.cnf.erb b/templates/my.cnf.erb index e09c7c9..c1a5010 100644 --- a/templates/my.cnf.erb +++ b/templates/my.cnf.erb @@ -6,6 +6,7 @@ socket = <%= socket %> nice = 0 [mysqld] user = mysql +pid-file = <%= pidfile %> socket = <%= socket %> port = <%= port %> basedir = <%= basedir %>