#2030 Only establish dependency between service and package if package is managed.
This commit is contained in:
parent
2c8a822f25
commit
6924dea7bd
2 changed files with 17 additions and 2 deletions
|
@ -31,7 +31,14 @@ class mysql::server::service {
|
|||
name => $mysql::server::service_name,
|
||||
enable => $mysql::server::real_service_enabled,
|
||||
provider => $mysql::server::service_provider,
|
||||
require => Package['mysql-server'],
|
||||
}
|
||||
|
||||
# only establish ordering between service and package if
|
||||
# we're managing the package.
|
||||
if $mysql::server::package_manage {
|
||||
Service['mysqld'] {
|
||||
require => Package[$mysql::server::package_name],
|
||||
}
|
||||
}
|
||||
|
||||
# only establish ordering between config file and service if
|
||||
|
|
|
@ -43,7 +43,15 @@ describe 'mysql::server' do
|
|||
context 'with defaults' do
|
||||
it { is_expected.to contain_service('mysqld') }
|
||||
end
|
||||
|
||||
context 'with package_manage set to true' do
|
||||
let(:params) {{ :package_manage => true }}
|
||||
it { is_expected.to contain_service('mysqld').that_requires('Package[mysql-server]') }
|
||||
end
|
||||
context 'with package_manage set to false' do
|
||||
let(:params) {{ :package_manage => false }}
|
||||
it { is_expected.to contain_service('mysqld') }
|
||||
it { is_expected.not_to contain_service('mysqld').that_requires('Package[mysql-server]') }
|
||||
end
|
||||
context 'service_enabled set to false' do
|
||||
let(:params) {{ :service_enabled => false }}
|
||||
|
||||
|
|
Loading…
Reference in a new issue