Merge "MySQL Client: Remove logic for non-containerized deployment"

This commit is contained in:
Zuul 2022-10-25 03:56:20 +00:00 committed by Gerrit Code Review
commit 124ef70e0d
2 changed files with 7 additions and 88 deletions

View File

@ -81,30 +81,12 @@ class tripleo::profile::base::database::mysql::client (
$conf_changes = union($client_bind_changes, $changes_ssl)
# Create /etc/my.cnf.d/tripleo.cnf
# If the folder /etc/my.cnf.d does not exist (e.g. if mariadb is not
# present in the base image but installed as a package afterwards),
# create it. We do not want to touch the permissions in case it already
# exists due to the mariadb server package being pre-installed
if $::deployment_type == 'containers' {
# When generating configuration with docker-puppet, services do
# not include any profile that would ensure creation of /etc/my.cnf.d,
# so we enforce the check here.
file {'/etc/my.cnf.d':
ensure => 'directory'
}
} else {
# Otherwise, depending on the role, puppet may run this profile
# concurrently with the mysql profile, so we use an exec resource
# in order to avoid getting duplicate declaration errors
exec { 'directory-create-etc-my.cnf.d':
command => 'mkdir -p /etc/my.cnf.d',
unless => 'test -d /etc/my.cnf.d',
path => ['/usr/bin', '/usr/sbin', '/bin', '/sbin'],
before => Augeas['tripleo-mysql-client-conf']
}
# When generating configuration with docker-puppet, services do
# not include any profile that would ensure creation of /etc/my.cnf.d,
# so we enforce the check here.
file {'/etc/my.cnf.d':
ensure => 'directory'
}
file { $mysql_read_default_file:
ensure => file,
}

View File

@ -24,61 +24,6 @@ describe 'tripleo::profile::base::database::mysql::client' do
{ :step => 1 }
end
before (:each) do
facts.merge!({ :deployment_type => 'notcontainers' })
end
it {
is_expected.to contain_exec('directory-create-etc-my.cnf.d')
is_expected.to contain_file('/etc/my.cnf.d/tripleo.cnf').with(
:ensure => 'file',
)
is_expected.to contain_augeas('tripleo-mysql-client-conf').with(
:incl => '/etc/my.cnf.d/tripleo.cnf',
:changes => [
'rm tripleo/bind-address',
'rm tripleo/ssl',
'rm tripleo/ssl-ca',
'rm client/ssl',
'rm client/ssl-ca'
]
)
}
end
context 'with defaults in containers' do
let (:params) do
{ :step => 1 }
end
before (:each) do
facts.merge!({ :deployment_type => 'containers' })
end
it {
is_expected.to contain_file('/etc/my.cnf.d').with(:ensure => 'directory')
is_expected.to contain_augeas('tripleo-mysql-client-conf').with(
:incl => '/etc/my.cnf.d/tripleo.cnf',
:changes => [
'rm tripleo/bind-address',
'rm tripleo/ssl',
'rm tripleo/ssl-ca',
'rm client/ssl',
'rm client/ssl-ca'
]
)
}
end
context 'with defaults with deployment_type' do
let (:params) do
{ :step => 1 }
end
before (:each) do
facts.merge!({ :deployment_type => 'notcontainers', :deployment_type => 'containers' })
end
it {
is_expected.to contain_file('/etc/my.cnf.d').with(:ensure => 'directory')
is_expected.to contain_augeas('tripleo-mysql-client-conf').with(
@ -101,12 +46,8 @@ describe 'tripleo::profile::base::database::mysql::client' do
}
end
before (:each) do
facts.merge!({ :deployment_type => 'notcontainers' })
end
it {
is_expected.to contain_exec('directory-create-etc-my.cnf.d')
is_expected.to contain_file('/etc/my.cnf.d').with(:ensure => 'directory')
is_expected.to contain_augeas('tripleo-mysql-client-conf').with(
:incl => '/etc/my.cnf.d/tripleo.cnf',
:changes => [
@ -128,12 +69,8 @@ describe 'tripleo::profile::base::database::mysql::client' do
}
end
before (:each) do
facts.merge!({ :deployment_type => 'notcontainers' })
end
it {
is_expected.to contain_exec('directory-create-etc-my.cnf.d')
is_expected.to contain_file('/etc/my.cnf.d').with(:ensure => 'directory')
is_expected.to contain_augeas('tripleo-mysql-client-conf').with(
:incl => '/etc/my.cnf.d/tripleo.cnf',
:changes => [