Allow disabling db sync task

The same mechanism was implemented widely in the other modules.

Change-Id: I26ad35a94ca2d6376f99a1f15cb623c8867f2264
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-09-18 00:38:16 +09:00
committed by Tobias Urdin
parent 390de6f52e
commit 3474f03634
3 changed files with 25 additions and 1 deletions

View File

@@ -63,6 +63,10 @@
# in the api config.
# Defaults to false.
#
# [*sync_db*]
# (optional) Enable dbsync.
# Defaults to true.
#
# [*cert_file*]
# (optinal) Certificate file to use when starting API server securely
# Defaults to false, not set
@@ -113,6 +117,7 @@ class trove::api (
$workers = $facts['os_workers'],
Boolean $enabled = true,
Boolean $purge_config = false,
Boolean $sync_db = true,
$cert_file = $facts['os_service_default'],
$key_file = $facts['os_service_default'],
$ca_file = $facts['os_service_default'],
@@ -126,9 +131,12 @@ class trove::api (
) inherits trove::params {
include trove::deps
include trove::db
include trove::db::sync
include trove::policy
if $sync_db {
include trove::db::sync
}
# basic service config
trove_config {
'DEFAULT/bind_host': value => $bind_host;

View File

@@ -0,0 +1,4 @@
---
features:
- |
The new ``trove::api::sync_db`` parameter has been added.

View File

@@ -113,6 +113,18 @@ describe 'trove::api' do
is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('2000')
end
end
context 'with db sync disabled' do
before :each do
params.merge!(
:sync_db => false,
)
end
it 'does not run db sync' do
is_expected.to_not contain_class('trove::db::sync')
end
end
end
end