Fix issue with mysql not restarting on new bind_ip

Addresses: bug #1277041

By default mysql binds to 127.0.0.1. Setting the bind_ip attribute to
something else, as we do in the ops-database cookbook before calling the
mysql::server recipe, causes the my.cnf to be populated with the correct IP.

However, because of this bug in the upstream mysql cookbook:
https://tickets.opscode.com/browse/COOK-4161
mysql does not get restarted (it only gets reloaded)
and so the new bind_ip does not take effect.

This commit adds a workaround until the upstream bug is fixed. The
workaround directly modifies the template resource from the resource
collection to add a 'restart mysql' notification.

Change-Id: I4f59e9f7fecb5040532948d0bb07d49385280a48
This commit is contained in:
Darren Birkett 2014-02-06 11:47:08 +00:00
parent d5d685bfb1
commit 0ae59969eb
2 changed files with 12 additions and 0 deletions

View File

@ -36,6 +36,13 @@ node.override['mysql']['tunable']['skip-name-resolve'] = true
include_recipe 'openstack-ops-database::mysql-client'
include_recipe 'mysql::server'
# NOTE:(mancdaz) This is a temporary workaround for this upstream bug in the
# mysql cookbook. It can be removed once the upstream issue is resolved:
#
# https://tickets.opscode.com/browse/COOK-4161
r = resources('template[/etc/mysql/my.cnf]')
r.notifies_immediately(:restart, 'service[mysql]')
mysql_connection_info = {
host: 'localhost',
username: 'root',

View File

@ -30,6 +30,11 @@ describe 'openstack-ops-database::mysql-server' do
expect(@chef_run).to include_recipe 'mysql::server'
end
it 'modifies my.cnf template to notify mysql restart' do
file = @chef_run.template '/etc/mysql/my.cnf'
expect(file).to notify('service[mysql]').to(:restart)
end
describe 'lwrps' do
before do
@connection = {