Cleanup CHEF-3694 cloning warnings

* lookup mysql service resource instead of re-declaring it
* use unique name for flush resource as it's two separate uses

Change-Id: I8746e5001ea5cefc497049111f4d2e5e250f26de
Partial-Bug: #1409921
This commit is contained in:
Mark Vanderwiel 2015-01-12 15:59:24 -06:00
parent c709f84f18
commit 408ad33b3f
3 changed files with 6 additions and 5 deletions

View File

@ -10,6 +10,7 @@ This file is used to list changes made in each version of the openstack-ops-data
* Bump mysql cookbook version for above password patch
* Bump Chef gem to 11.16
* Allow max_connections override for mysql server
* Cleanup CHEF-3694 warnings
## 9.2.0
* Update database and mysql dependency

View File

@ -61,7 +61,7 @@ end
# Set the version attribute based on what was actually
# installed.
server_resource = mysql_service node['mysql']['service_name']
server_resource = resources("mysql_service[#{node['mysql']['service_name']}]")
server_version = server_resource.parsed_version
node.set['mysql']['version'] = server_version
@ -78,7 +78,7 @@ mysql_connection_info = {
password: super_password
}
mysql_database 'FLUSH PRIVILEGES' do
mysql_database 'FLUSH PRIVILEGES pre query' do
connection mysql_connection_info
sql 'FLUSH PRIVILEGES'
action :query
@ -100,7 +100,7 @@ mysql_database 'test' do
action :drop
end
mysql_database 'FLUSH PRIVILEGES' do
mysql_database 'FLUSH PRIVILEGES post query' do
connection mysql_connection_info
sql 'FLUSH PRIVILEGES'
action :query

View File

@ -54,10 +54,10 @@ describe 'openstack-ops-database::mysql-server' do
end
it 'prepares the database server' do
expect(chef_run).to query_mysql_database('FLUSH PRIVILEGES')
expect(chef_run).to query_mysql_database('FLUSH PRIVILEGES pre query')
expect(chef_run).to query_mysql_database('drop empty localhost user')
expect(chef_run).to drop_mysql_database('test')
expect(chef_run).to query_mysql_database('FLUSH PRIVILEGES')
expect(chef_run).to query_mysql_database('FLUSH PRIVILEGES post query')
end
it 'creates mysql service' do