Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions manifests/plugin/container_gateway.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#
# $postgresql_password:: User password for the postgres database
#
# $database_max_connections:: Maximum number of DB connections
#
# $database_pool_timeout:: Time in seconds to wait for DB connection
#
# $sqlite_db_path:: Absolute path for the SQLite DB file to exist at
#
# $sqlite_timeout:: Database busy timeout in milliseconds
Expand Down Expand Up @@ -48,6 +52,8 @@
String $postgresql_database = 'container_gateway',
Optional[String[1]] $postgresql_user = undef,
Optional[String] $postgresql_password = undef,
Optional[Integer] $database_max_connections = undef,
Optional[Integer] $database_pool_timeout = undef,
Optional[Stdlib::HTTPUrl] $client_endpoint = undef,
) {
foreman_proxy::plugin::module { 'container_gateway':
Expand Down
19 changes: 19 additions & 0 deletions spec/classes/foreman_proxy__plugin__container_gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,25 @@
])
end
end

describe 'with database connection pool parameters' do
let :params do {
:database_max_connections => 20,
:database_pool_timeout => 30,
} end

it 'container_gateway.yml should contain configuration with database pool settings' do
verify_exact_contents(catalogue, '/etc/foreman-proxy/settings.d/container_gateway.yml', [
'---',
':enabled: https',
":pulp_endpoint: https://#{facts[:networking]['fqdn']}",
':sqlite_db_path: /var/lib/foreman-proxy/smart_proxy_container_gateway.db',
':db_connection_string: postgres:///container_gateway',
':db_max_connections: 20',
':db_pool_timeout: 30'
])
end
end
end
end
end
6 changes: 6 additions & 0 deletions templates/plugin/container_gateway.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ when 'sqlite'
end
-%>
:db_connection_string: <%= uri %>
<% if scope.lookupvar("foreman_proxy::plugin::container_gateway::database_max_connections") -%>
:db_max_connections: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::database_max_connections") %>
<% end -%>
<% if scope.lookupvar("foreman_proxy::plugin::container_gateway::database_pool_timeout") -%>
:db_pool_timeout: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::database_pool_timeout") %>
<% end -%>
Loading