Skip to content

Commit

Permalink
Merge 5a3b805 into 6915b3e
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher committed Mar 2, 2020
2 parents 6915b3e + 5a3b805 commit 26e39e9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@
}
} else {
if $proxysql::restart {
if versioncmp($proxysql::version, '2') >= 0 and fact('os.family') == 'RedHat' {
# In proxysql version 2, the init.d scripts, (EL6 and EL7 with proxysql < 2.0.7) support a `reload` option.
# Use this instead of `/usr/bin/proxysql --reload`, (which will run as root).
$start = '/etc/init.d/proxysql reload'
} else {
$start = '/usr/bin/proxysql --reload'
}
service { $proxysql::service_name:
ensure => $proxysql::service_ensure,
enable => true,
hasstatus => true,
hasrestart => false,
provider => 'base',
status => '/etc/init.d/proxysql status',
start => '/usr/bin/proxysql --reload',
start => $start,
stop => '/etc/init.d/proxysql stop',
}
} else {
Expand Down
15 changes: 15 additions & 0 deletions spec/classes/proxysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@
enable: true)
end

if facts[:osfamily] == 'RedHat'
context 'with restart = true' do
context 'and proxysql 1.4.16' do
let(:params) { { 'restart' => true, 'version' => '1.4.16' } }

it { is_expected.to contain_service('proxysql').with_start('/usr/bin/proxysql --reload') }
end
context 'and proxysql 2.0.6' do
let(:params) { { 'restart' => true, 'version' => '2.0.6' } }

it { is_expected.to contain_service('proxysql').with_start('/etc/init.d/proxysql reload') }
end
end
end

unless (facts[:osfamily] == 'RedHat' && facts[:operatingsystemmajrelease] == '7') ||
(facts[:operatingsystem] == 'Ubuntu' && facts[:operatingsystemmajrelease] == '18.04') ||
(facts[:operatingsystem] == 'Debian' && facts[:operatingsystemmajrelease] =~ %r{^(9|10)$})
Expand Down

0 comments on commit 26e39e9

Please sign in to comment.