From 7ed85738990855b62422f1f2846d47f3032a8977 Mon Sep 17 00:00:00 2001 From: Jens Harbott Date: Wed, 16 Sep 2020 10:39:44 +0200 Subject: [PATCH] Fix mariadb repo setup Instead of always creating the mariadb default repository we should only do it when requested by the node environment. Do this implicitly via the mariadb_*_install resources that have an option to decide whether a repo should be set up or not. Change-Id: I4f62dd7a7df247ddb787553bef58ca81d8e062fb --- attributes/mysql.rb | 2 ++ recipes/mariadb-client.rb | 5 +---- recipes/mariadb-server.rb | 1 + spec/mariadb-client_spec.rb | 4 ---- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/attributes/mysql.rb b/attributes/mysql.rb index 3a086ec..308ac07 100644 --- a/attributes/mysql.rb +++ b/attributes/mysql.rb @@ -20,6 +20,8 @@ # MariaDB version default['openstack']['mariadb']['version'] = '10.3' +# Whether to set up mariadb repo +default['openstack']['mariadb']['setup_repo'] = true # Storage engine, base OpenStack requires the InnoDB flavor default['openstack']['mysql']['default-storage-engine'] = 'InnoDB' # InnoDB lock mode for generating auto-increment values diff --git a/recipes/mariadb-client.rb b/recipes/mariadb-client.rb index ab12750..98a3b80 100644 --- a/recipes/mariadb-client.rb +++ b/recipes/mariadb-client.rb @@ -15,12 +15,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -mariadb_repository 'default' do - version node['openstack']['mariadb']['version'] -end - mariadb_client_install 'default' do version node['openstack']['mariadb']['version'] + setup_repo node['openstack']['mariadb']['setup_repo'] end node['openstack']['db']['python_packages']['mariadb'].each do |pkg| diff --git a/recipes/mariadb-server.rb b/recipes/mariadb-server.rb index a6de1da..9e861ed 100644 --- a/recipes/mariadb-server.rb +++ b/recipes/mariadb-server.rb @@ -36,6 +36,7 @@ include_recipe 'openstack-ops-database::mariadb-client' mariadb_server_install 'default' do version node['openstack']['mariadb']['version'] password super_password + setup_repo node['openstack']['mariadb']['setup_repo'] action [:install, :create] end diff --git a/spec/mariadb-client_spec.rb b/spec/mariadb-client_spec.rb index e54355c..7f00d3d 100644 --- a/spec/mariadb-client_spec.rb +++ b/spec/mariadb-client_spec.rb @@ -14,10 +14,6 @@ describe 'openstack-ops-database::mariadb-client' do runner.converge(described_recipe) end - it do - expect(chef_run).to add_mariadb_repository('default').with(version: '10.3') - end - it do expect(chef_run).to install_mariadb_client_install('default').with(version: '10.3') end