Skip to content

Commit

Permalink
Refs #22513 - Expose the dynflow file limit
Browse files Browse the repository at this point in the history
  • Loading branch information
chris1984 authored and mmoll committed Feb 27, 2018
1 parent 7f65ad6 commit e72eb02
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions manifests/plugin/dynflow.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#
# $tls_disabled_versions:: Disable TLS versions. Version 1.0 is always disabled. For example: ['1.1']
#
# $open_file_limit:: Limit number of open files - Only Red Hat Operating Systems with Software Collections.
#
class foreman_proxy::plugin::dynflow (
Boolean $enabled = $::foreman_proxy::plugin::dynflow::params::enabled,
Foreman_proxy::ListenOn $listen_on = $::foreman_proxy::plugin::dynflow::params::listen_on,
Expand All @@ -31,6 +33,7 @@
Integer[0, 65535] $core_port = $::foreman_proxy::plugin::dynflow::params::core_port,
Optional[Array[String]] $ssl_disabled_ciphers = $::foreman_proxy::plugin::dynflow::params::ssl_disabled_ciphers,
Optional[Array[String]] $tls_disabled_versions = $::foreman_proxy::plugin::dynflow::params::tls_disabled_versions,
Integer[1] $open_file_limit = $::foreman_proxy::plugin::dynflow::params::open_file_limit,
) inherits foreman_proxy::plugin::dynflow::params {
if $::foreman_proxy::ssl {
$core_url = "https://${::fqdn}:${core_port}"
Expand Down Expand Up @@ -66,6 +69,12 @@
ensure => link,
target => '/etc/foreman-proxy/settings.d',
}
~> systemd::service_limits { 'smart_proxy_dynflow_core.service':
limits => {
'LimitNOFILE' => $open_file_limit,
},
restart_service => false,
}
~> service { 'smart_proxy_dynflow_core':
ensure => running,
enable => true,
Expand Down
1 change: 1 addition & 0 deletions manifests/plugin/dynflow/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
$core_port = 8008
$ssl_disabled_ciphers = undef
$tls_disabled_versions = undef
$open_file_limit = 1000000
}
15 changes: 14 additions & 1 deletion spec/classes/foreman_proxy__plugin__dynflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
with_ensure('link').with_target("#{etc_dir}/foreman-proxy/settings.d")
end

it 'should create systemd service limits' do
should contain_systemd__service_limits('smart_proxy_dynflow_core.service').
with_limits({'LimitNOFILE' => 1000000}).that_notifies('Service[smart_proxy_dynflow_core]')
end

it 'should generate correct dynflow core settings.yml' do
verify_exact_contents(catalogue, "#{etc_dir}/smart_proxy_dynflow_core/settings.yml", [
"---",
Expand All @@ -63,14 +68,16 @@
it { should_not contain_file("#{etc_dir}/smart_proxy_dynflow_core/settings.d") }
it { should_not contain_file("#{etc_dir}/smart_proxy_dynflow_core/settings.yml") }
it { should_not contain_service('smart_proxy_dynflow_core') }
it { should_not contain_systemd__service_limits('smart_proxy_dynflow_core.service') }
end
end

describe 'with custom settings' do
let :params do {
:database_path => '/var/lib/foreman-proxy/dynflow/dynflow.sqlite',
:ssl_disabled_ciphers => ['NULL-MD5', 'NULL-SHA'],
:tls_disabled_versions => ['1.1']
:tls_disabled_versions => ['1.1'],
:open_file_limit => 8000
} end

it { should compile.with_all_deps }
Expand All @@ -82,6 +89,11 @@
with_ensure('link').with_target("#{etc_dir}/foreman-proxy/settings.d")
end

it 'should create systemd service limits' do
should contain_systemd__service_limits('smart_proxy_dynflow_core.service').
with_limits({'LimitNOFILE' => 8000}).that_notifies('Service[smart_proxy_dynflow_core]')
end

it 'should generate correct dynflow core settings.yml' do
verify_exact_contents(catalogue, "#{etc_dir}/smart_proxy_dynflow_core/settings.yml", [
'---',
Expand All @@ -103,6 +115,7 @@
it { should_not contain_file("#{etc_dir}/smart_proxy_dynflow_core/settings.d") }
it { should_not contain_file("#{etc_dir}/smart_proxy_dynflow_core/settings.yml") }
it { should_not contain_service('smart_proxy_dynflow_core') }
it { should_not contain_systemd__service_limits('smart_proxy_dynflow_core.service') }
end
end
end
Expand Down

0 comments on commit e72eb02

Please sign in to comment.