build: Rework patch mechanism for Fuel submodules
[armband.git] / patches / fuel-library / upstream-backports / 0002-Always-wait-for-MySQL-sync-on-service-refresh.patch
1 From: dmburmistrov <dmburmistrov@mirantis.com>
2 Date: Thu, 18 Aug 2016 21:30:26 +0300
3 Subject: [PATCH] Always wait for MySQL sync on service refresh
4
5 Always trigger Exec['wait-for-sync'] on
6 MySQL service refresh.
7
8 Closes-bug: #1614647
9
10 Change-Id: I82ec0d46eff217daedc1bd07c67069498c515c44
11 ---
12  deployment/puppet/cluster/manifests/mysql.pp                 | 6 +++---
13  deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb | 6 +++++-
14  2 files changed, 8 insertions(+), 4 deletions(-)
15
16 diff --git a/deployment/puppet/cluster/manifests/mysql.pp b/deployment/puppet/cluster/manifests/mysql.pp
17 index c36b65d..f483cf6 100644
18 --- a/deployment/puppet/cluster/manifests/mysql.pp
19 +++ b/deployment/puppet/cluster/manifests/mysql.pp
20 @@ -104,7 +104,7 @@ class cluster::mysql (
21      require => Package['mysql-server'],
22    } ~>
23
24 -  exec { 'wait-initial-sync':
25 +  exec { 'wait-for-sync':
26      path        => '/bin:/sbin:/usr/bin:/usr/sbin',
27      command     => "mysql ${user_password_string} -Nbe \"show status like 'wsrep_local_state_comment'\" | grep -q -e Synced && sleep 10",
28      try_sleep   => 10,
29 @@ -119,7 +119,7 @@ class cluster::mysql (
30    }
31
32    Exec['create-init-file'] ->
33 -    Service<| title == $service_name |> ->
34 -      Exec['wait-initial-sync'] ->
35 +    Service<| title == $service_name |> ~>
36 +      Exec['wait-for-sync'] ->
37          Exec['rm-init-file']
38  }
39 diff --git a/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb b/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb
40 index cf2c719..72c8c2f 100644
41 --- a/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb
42 +++ b/deployment/puppet/cluster/spec/classes/cluster_mysql_spec.rb
43 @@ -34,12 +34,16 @@ describe 'cluster::mysql' do
44            /'username'@'localhost' IDENTIFIED BY 'password'/
45          )
46          should contain_exec('create-init-file').that_comes_before('Service[mysqld]')
47 -        should contain_exec('create-init-file').that_notifies('Exec[wait-initial-sync]')
48 +        should contain_exec('create-init-file').that_notifies('Exec[wait-for-sync]')
49        end
50
51        it 'creates exec to remove init-file' do
52          should contain_exec('rm-init-file')
53        end
54 +
55 +      it 'creates exec to wait initial database sync' do
56 +        should contain_exec('wait-for-sync').that_subscribes_to('Service[mysqld]')
57 +      end
58      end
59
60    end