1 From: Maksim Malchuk <mmalchuk@mirantis.com>
2 Date: Wed, 24 Aug 2016 00:15:02 +0300
3 Subject: [PATCH] Fix MySQL logging dir permissions for syslog
5 This change fixes permissions for MySQL logging directory to enable
6 syslogd create and write logs files into it.
9 Change-Id: Id29aead6619ea8ed68811d0fd80895ee79f51687
10 Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
11 (cherry picked from commit 9c978278811eeebfb11ab4d2b42ebabe00c132c2)
13 deployment/puppet/cluster/manifests/mysql.pp | 14 +++++++++++---
14 .../puppet/cluster/spec/classes/cluster_mysql_spec.rb | 11 ++++++++++-
15 tests/noop/spec/hosts/database/database_spec.rb | 9 +++++++++
16 3 files changed, 30 insertions(+), 4 deletions(-)
18 diff --git a/deployment/puppet/cluster/manifests/mysql.pp b/deployment/puppet/cluster/manifests/mysql.pp
19 index f483cf6..7bc8874 100644
20 --- a/deployment/puppet/cluster/manifests/mysql.pp
21 +++ b/deployment/puppet/cluster/manifests/mysql.pp
22 @@ -118,8 +118,16 @@ class cluster::mysql (
23 onlyif => 'test -f /tmp/wsrep-init-file',
26 + file { 'fix-log-dir':
27 + ensure => directory,
28 + path => '/var/log/mysql',
30 + require => Package['mysql-server'],
33 Exec['create-init-file'] ->
34 - Service<| title == $service_name |> ~>
35 - Exec['wait-for-sync'] ->
36 - Exec['rm-init-file']
37 + File['fix-log-dir'] ->
38 + Service<| title == $service_name |> ~>
39 + Exec['wait-for-sync'] ->
40 + Exec['rm-init-file']
42 diff --git a/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb b/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb
43 index 72c8c2f..ad3fc1b 100644
44 --- a/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb
45 +++ b/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb
46 @@ -33,7 +33,7 @@ describe 'cluster::mysql' do
47 should contain_exec('create-init-file').with_command(
48 /'username'@'localhost' IDENTIFIED BY 'password'/
50 - should contain_exec('create-init-file').that_comes_before('Service[mysqld]')
51 + should contain_exec('create-init-file').that_comes_before('File[fix-log-dir]')
52 should contain_exec('create-init-file').that_notifies('Exec[wait-for-sync]')
55 @@ -41,6 +41,15 @@ describe 'cluster::mysql' do
56 should contain_exec('rm-init-file')
59 + it 'should have correct permissions for logging directory' do
60 + should contain_file('fix-log-dir').with(
61 + :ensure => 'directory',
62 + :path => '/var/log/mysql',
64 + ).that_requires('Package[mysql-server]')
65 + should contain_file('fix-log-dir').that_comes_before('Service[mysqld]')
68 it 'creates exec to wait initial database sync' do
69 should contain_exec('wait-for-sync').that_subscribes_to('Service[mysqld]')
71 diff --git a/tests/noop/spec/hosts/database/database_spec.rb b/tests/noop/spec/hosts/database/database_spec.rb
72 index d4ad8d0..2c4c5c5 100644
73 --- a/tests/noop/spec/hosts/database/database_spec.rb
74 +++ b/tests/noop/spec/hosts/database/database_spec.rb
75 @@ -261,6 +261,15 @@ describe manifest do
79 + it 'should have correct permissions for logging directory' do
80 + should contain_file('fix-log-dir').with(
81 + :ensure => 'directory',
82 + :path => '/var/log/mysql',
84 + ).that_requires('Package[mysql-server]')
85 + should contain_file('fix-log-dir').that_comes_before('Service[mysqld]')
88 it 'should configure galera grants service and proper flow' do
90 should contain_class('cluster::galera_grants').with(