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
This commit is contained in:
Jens Harbott 2020-09-16 10:39:44 +02:00
parent 0b08fc6142
commit 7ed8573899
4 changed files with 4 additions and 8 deletions

View File

@ -20,6 +20,8 @@
# MariaDB version # MariaDB version
default['openstack']['mariadb']['version'] = '10.3' 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 # Storage engine, base OpenStack requires the InnoDB flavor
default['openstack']['mysql']['default-storage-engine'] = 'InnoDB' default['openstack']['mysql']['default-storage-engine'] = 'InnoDB'
# InnoDB lock mode for generating auto-increment values # InnoDB lock mode for generating auto-increment values

View File

@ -15,12 +15,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
mariadb_repository 'default' do
version node['openstack']['mariadb']['version']
end
mariadb_client_install 'default' do mariadb_client_install 'default' do
version node['openstack']['mariadb']['version'] version node['openstack']['mariadb']['version']
setup_repo node['openstack']['mariadb']['setup_repo']
end end
node['openstack']['db']['python_packages']['mariadb'].each do |pkg| node['openstack']['db']['python_packages']['mariadb'].each do |pkg|

View File

@ -36,6 +36,7 @@ include_recipe 'openstack-ops-database::mariadb-client'
mariadb_server_install 'default' do mariadb_server_install 'default' do
version node['openstack']['mariadb']['version'] version node['openstack']['mariadb']['version']
password super_password password super_password
setup_repo node['openstack']['mariadb']['setup_repo']
action [:install, :create] action [:install, :create]
end end

View File

@ -14,10 +14,6 @@ describe 'openstack-ops-database::mariadb-client' do
runner.converge(described_recipe) runner.converge(described_recipe)
end end
it do
expect(chef_run).to add_mariadb_repository('default').with(version: '10.3')
end
it do it do
expect(chef_run).to install_mariadb_client_install('default').with(version: '10.3') expect(chef_run).to install_mariadb_client_install('default').with(version: '10.3')
end end