From 257e3f9a2d5f55fb15d8ffc2b08bf2b87bbf8792 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 28 Jan 2014 10:52:50 +0100 Subject: [PATCH] database/sql: Clean-up I did not change the behavior of Sofer fix, just did some clean-up: - git rebase - delete cloud::debian::galera_patch class and use cloud::database::sql in the case. - rename the initd mysql template to be able having one template for RHEL later if needed. - fix unit tests Note: - The bug is not fixed on RHEL yet - Unit tests are incomplete and don't cover when galera master role. Fix #11 Signed-off-by: Emilien Macchi --- manifests/database/sql.pp | 11 ++++- manifests/debian/galera_patch.pp | 45 ------------------- spec/classes/cloud_database_sql_spec.rb | 4 +- ...etc_initd_mysql => etc_initd_mysql_debian} | 0 4 files changed, 12 insertions(+), 48 deletions(-) delete mode 100644 manifests/debian/galera_patch.pp rename templates/database/{etc_initd_mysql => etc_initd_mysql_debian} (100%) diff --git a/manifests/database/sql.pp b/manifests/database/sql.pp index 76ce639f..be2590b8 100644 --- a/manifests/database/sql.pp +++ b/manifests/database/sql.pp @@ -94,7 +94,16 @@ class cloud::database::sql ( } if($::osfamily == 'Debian'){ - class { 'cloud::debian::galera_patch' : } + + file { '/etc/init.d/mysql-bootstrap': + content => template('cloud/database/etc_initd_mysql_debian'), + owner => 'root', + mode => '0755', + group => 'root', + notify => Service['mysqld'], + before => Package['mysql-server'], + } + } $gcomm_base = inline_template('<%= @galera_internal_ips.join(",") + "?pc.wait_prim=no" -%>') diff --git a/manifests/debian/galera_patch.pp b/manifests/debian/galera_patch.pp deleted file mode 100644 index cbb62d91..00000000 --- a/manifests/debian/galera_patch.pp +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (C) 2013 eNovance SAS -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# == Class: cloud::debian::galera_patch -# -# Install a dedicated mysqld init script -# -# This is due to this bug: https://bugs.launchpad.net/codership-mysql/+bug/1087368 -# -# The backport to API 23 requires a command line option --wsrep-new-cluster: -# -# http://bazaar.launchpad.net/~codership/codership-mysql/wsrep-5.5/revision/3844?start_revid=3844 -# -# and the mysql init script cannot have arguments passed to the daemon -# using /etc/default/mysql standart mechanism -# -# To check that the mysqld support the options you can : -# strings `which mysqld` | grep wsrep-new-cluster -# -# TODO: to be remove as soon as the API 25 is packaged, ie galera 3 ... -class cloud::debian::galera_patch ( - ) { - - # replace the file - file { '/etc/init.d/mysql-bootstrap': - content => template('cloud/database/etc_initd_mysql'), - owner => 'root', - mode => '0755', - group => 'root', - notify => Service['mysqld'], - before => Package['mysql-server'], - } -} diff --git a/spec/classes/cloud_database_sql_spec.rb b/spec/classes/cloud_database_sql_spec.rb index d2d6ed95..e70bad56 100644 --- a/spec/classes/cloud_database_sql_spec.rb +++ b/spec/classes/cloud_database_sql_spec.rb @@ -31,7 +31,7 @@ describe 'cloud::database::sql' do :service_provider => 'sysv', :api_eth => '10.0.0.1', :galera_master_name => 'os-ci-test1', - :galera_nextserver => ['10.0.0.1','10.0.0.2','10.0.0.3'], + :galera_internal_ips => ['10.0.0.1','10.0.0.2','10.0.0.3'], :keystone_db_host => '10.0.0.1', :keystone_db_user => 'keystone', :keystone_db_password => 'secrete', @@ -73,7 +73,7 @@ describe 'cloud::database::sql' do ) should contain_class('mysql::server').with( - :config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password] }, + :config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password], 'service_name' => 'mysql' }, :notify => 'Service[xinetd]' ) end # configure mysql galera server diff --git a/templates/database/etc_initd_mysql b/templates/database/etc_initd_mysql_debian similarity index 100% rename from templates/database/etc_initd_mysql rename to templates/database/etc_initd_mysql_debian