From bd7321b634c06519881246cfdfecd5459e878180 Mon Sep 17 00:00:00 2001 From: Ian Ballou Date: Fri, 22 Sep 2023 17:34:30 -0400 Subject: [PATCH] Fixes #36772 - container gateway db timeout tuning --- manifests/plugin/container_gateway.pp | 3 +++ .../foreman_proxy__plugin__container_gateway_spec.rb | 7 +++++-- templates/plugin/container_gateway.yml.erb | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/manifests/plugin/container_gateway.pp b/manifests/plugin/container_gateway.pp index 56b2d03c..b66b0acf 100644 --- a/manifests/plugin/container_gateway.pp +++ b/manifests/plugin/container_gateway.pp @@ -6,6 +6,8 @@ # # $sqlite_db_path:: Absolute path for the SQLite DB file to exist at # +# $sqlite_timeout:: Database busy timeout in milliseconds +# # === Advanced parameters: # # $enabled:: enables/disables the pulp plugin @@ -21,6 +23,7 @@ Foreman_proxy::ListenOn $listen_on = 'https', Stdlib::HTTPUrl $pulp_endpoint = "https://${facts['networking']['fqdn']}", Stdlib::Absolutepath $sqlite_db_path = '/var/lib/foreman-proxy/smart_proxy_container_gateway.db', + Integer $sqlite_timeout = 30_000, ) { foreman_proxy::plugin::module { 'container_gateway': version => $version, diff --git a/spec/classes/foreman_proxy__plugin__container_gateway_spec.rb b/spec/classes/foreman_proxy__plugin__container_gateway_spec.rb index 82281db0..736e2f6a 100644 --- a/spec/classes/foreman_proxy__plugin__container_gateway_spec.rb +++ b/spec/classes/foreman_proxy__plugin__container_gateway_spec.rb @@ -13,7 +13,8 @@ '---', ':enabled: https', ":pulp_endpoint: https://#{facts[:fqdn]}", - ':sqlite_db_path: /var/lib/foreman-proxy/smart_proxy_container_gateway.db' + ':sqlite_db_path: /var/lib/foreman-proxy/smart_proxy_container_gateway.db', + ':sqlite_timeout: 30000' ]) end end @@ -22,6 +23,7 @@ let :params do { :pulp_endpoint => 'https://test.example.com', :sqlite_db_path => '/dev/null.db', + :sqlite_timeout => 12_345, } end it 'container_gateway.yml should contain the correct configuration' do @@ -29,7 +31,8 @@ '---', ':enabled: https', ':pulp_endpoint: https://test.example.com', - ':sqlite_db_path: /dev/null.db' + ':sqlite_db_path: /dev/null.db', + ':sqlite_timeout: 12345' ]) end end diff --git a/templates/plugin/container_gateway.yml.erb b/templates/plugin/container_gateway.yml.erb index 245c97cc..3a39cbee 100644 --- a/templates/plugin/container_gateway.yml.erb +++ b/templates/plugin/container_gateway.yml.erb @@ -3,3 +3,4 @@ :enabled: <%= @module_enabled %> :pulp_endpoint: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::pulp_endpoint") %> :sqlite_db_path: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_db_path") %> +:sqlite_timeout: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_timeout") %>