Skip to content

Commit

Permalink
fix parameter $manage_service_limits not working, closes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenki committed Nov 1, 2022
1 parent f0ed4ab commit 22c21eb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
28 changes: 15 additions & 13 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@
assert_private()

# Configure resource limits on Linux.
if ($facts['kernel'] == 'Linux') {
# Configure systemd service limits.
systemd::service_limits { "${solr::service_name}.service":
limits => {
'LimitNOFILE' => $solr::limit_file_max,
'LimitNPROC' => $solr::limit_proc_max,
'TasksMax' => $solr::limit_proc_max,
},
restart_service => false,
}
if ($solr::manage_service_limits) {
if ($facts['kernel'] == 'Linux') {
# Configure systemd service limits.
systemd::service_limits { "${solr::service_name}.service":
limits => {
'LimitNOFILE' => $solr::limit_file_max,
'LimitNPROC' => $solr::limit_proc_max,
'TasksMax' => $solr::limit_proc_max,
},
restart_service => false,
}

# Additionally set limits for the Solr user.
limits::limits { "${solr::solr_user}/nofile": both => $solr::limit_file_max }
limits::limits { "${solr::solr_user}/nproc": both => $solr::limit_proc_max }
# Additionally set limits for the Solr user.
limits::limits { "${solr::solr_user}/nofile": both => $solr::limit_file_max }
limits::limits { "${solr::solr_user}/nproc": both => $solr::limit_proc_max }
}
}

service { $solr::service_name:
Expand Down
15 changes: 15 additions & 0 deletions spec/classes/solr_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@

it { is_expected.to contain_service('solr') }
end

context 'solr class when manage_service_limits is set to false' do
let(:params) do
{
manage_service_limits: false,
version: '9.0.0',
}
end

it { is_expected.to compile.with_all_deps }

it { is_expected.not_to contain_systemd__service_limits('solr.service') }
it { is_expected.not_to contain_limits__limits('solr/nofile') }
it { is_expected.not_to contain_limits__limits('solr/nproc') }
end
end
end
end
Expand Down

0 comments on commit 22c21eb

Please sign in to comment.