This commit applied the check on all galera hosts
The http check is now installed on all galera nodes. Spec coverage is imporved and I made some clean in this manifest (comments) Closes: #24
This commit is contained in:
committed by
Sebastien Badia
parent
4ae50e67b0
commit
71852e6ecc
@@ -18,7 +18,7 @@
|
||||
|
||||
class cloud::database::sql (
|
||||
$api_eth = $os_params::api_eth,
|
||||
$service_provider = sysv,
|
||||
$service_provider = 'sysv',
|
||||
$galera_nextserver = $os_params::galera_nextserver,
|
||||
$galera_master = $os_params::galera_master,
|
||||
$mysql_password = $os_params::mysql_password,
|
||||
@@ -175,32 +175,32 @@ class cloud::database::sql (
|
||||
|
||||
Database_user<<| |>>
|
||||
|
||||
# Haproxy http monitoring
|
||||
file_line { 'mysqlchk-in-etc-services':
|
||||
path => '/etc/services',
|
||||
line => 'mysqlchk 9200/tcp',
|
||||
match => '^mysqlchk 9200/tcp$',
|
||||
notify => Service['xinetd'];
|
||||
}
|
||||
|
||||
file {
|
||||
'/etc/xinetd.d/mysqlchk':
|
||||
content => template('cloud/database/mysqlchk.erb'),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
require => File['/usr/bin/clustercheck'],
|
||||
notify => Service['xinetd'];
|
||||
'/usr/bin/clustercheck':
|
||||
ensure => present,
|
||||
content => template('cloud/database/clustercheck.erb'),
|
||||
mode => '0755',
|
||||
owner => 'root',
|
||||
group => 'root';
|
||||
}
|
||||
|
||||
} # if $::hostname == $galera_master
|
||||
|
||||
# Haproxy http monitoring
|
||||
file_line { 'mysqlchk-in-etc-services':
|
||||
path => '/etc/services',
|
||||
line => 'mysqlchk 9200/tcp',
|
||||
match => '^mysqlchk 9200/tcp$',
|
||||
notify => Service['xinetd'];
|
||||
}
|
||||
|
||||
file {
|
||||
'/etc/xinetd.d/mysqlchk':
|
||||
content => template('cloud/database/mysqlchk.erb'),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
require => File['/usr/bin/clustercheck'],
|
||||
notify => Service['xinetd'];
|
||||
'/usr/bin/clustercheck':
|
||||
ensure => present,
|
||||
content => template('cloud/database/clustercheck.erb'),
|
||||
mode => '0755',
|
||||
owner => 'root',
|
||||
group => 'root';
|
||||
}
|
||||
|
||||
exec{'clean-mysql-binlog':
|
||||
# first sync take a long time
|
||||
command => '/bin/bash -c "/usr/bin/mysqladmin --defaults-file=/root/.my.cnf shutdown ; killall -9 nc ; /bin/rm -f /var/lib/mysql/ib_logfile* || { true ; sleep 60 ; }"',
|
||||
@@ -213,7 +213,8 @@ class cloud::database::sql (
|
||||
|
||||
|
||||
file{'/etc/mysql/sys.cnf':
|
||||
content => "# Automatically generated. DO NOT TOUCH!
|
||||
content => "# Managed by Puppet
|
||||
# Module cloud::database::sql
|
||||
[client]
|
||||
host = localhost
|
||||
user = sys-maint
|
||||
@@ -230,9 +231,6 @@ basedir = /usr
|
||||
require => Exec['clean-mysql-binlog'],
|
||||
}
|
||||
|
||||
# Disabled because monitor depends on checkmulti which is broken
|
||||
# class { 'monitor::galera::httpsrv': }
|
||||
|
||||
# TODO/WARNING(Gonéri): template changes do not trigger configuration changes
|
||||
mysql::server::config{'basic_config':
|
||||
notify_service => true,
|
||||
|
||||
@@ -76,6 +76,20 @@ describe 'cloud::database::sql' do
|
||||
)
|
||||
end
|
||||
|
||||
context 'configure mysqlchk http replication' do
|
||||
it { should contain_file_line('mysqlchk-in-etc-services').with(
|
||||
:line => 'mysqlchk 9200/tcp',
|
||||
:path => '/etc/services',
|
||||
:notify => 'Service[xinetd]'
|
||||
)}
|
||||
|
||||
it { should contain_file('/etc/xinetd.d/mysqlchk').with_mode('0755') }
|
||||
it { should contain_file('/usr/bin/clustercheck').with_mode('0755') }
|
||||
it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_USERNAME="#{params[:cluster_check_dbuser]}"/)}
|
||||
it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_PASSWORD="#{params[:cluster_check_dbpassword]}"/)}
|
||||
|
||||
end
|
||||
|
||||
context 'configure databases on the galera master server' do
|
||||
|
||||
before :each do
|
||||
@@ -141,12 +155,12 @@ describe 'cloud::database::sql' do
|
||||
:ensure => 'present',
|
||||
:charset => 'utf8'
|
||||
)
|
||||
should contain_database_user('clustercheckuser@localhost').with(
|
||||
should contain_database_user("#{params[:cluster_check_dbuser]}@localhost").with(
|
||||
:ensure => 'present',
|
||||
:password_hash => '*FDC68394456829A7344C2E9D4CDFD43DCE2EFD8F',
|
||||
:provider => 'mysql'
|
||||
)
|
||||
should contain_database_grant('clustercheckuser@localhost/monitoring').with(
|
||||
should contain_database_grant("#{params[:cluster_check_dbuser]}@localhost/monitoring").with(
|
||||
:privileges => 'all'
|
||||
)
|
||||
should contain_database_user('sys-maint@localhost').with(
|
||||
|
||||
Reference in New Issue
Block a user