From 3474f03634b4f3c6728f2d7aee2d545d99c03ce3 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 18 Sep 2025 00:38:16 +0900 Subject: [PATCH] Allow disabling db sync task The same mechanism was implemented widely in the other modules. Change-Id: I26ad35a94ca2d6376f99a1f15cb623c8867f2264 Signed-off-by: Takashi Kajinami --- manifests/api.pp | 10 +++++++++- releasenotes/notes/sync_db-57aa90292b82ab6a.yaml | 4 ++++ spec/classes/trove_api_spec.rb | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/sync_db-57aa90292b82ab6a.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 1cde2b65..ae815d8a 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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; diff --git a/releasenotes/notes/sync_db-57aa90292b82ab6a.yaml b/releasenotes/notes/sync_db-57aa90292b82ab6a.yaml new file mode 100644 index 00000000..c7fcc665 --- /dev/null +++ b/releasenotes/notes/sync_db-57aa90292b82ab6a.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``trove::api::sync_db`` parameter has been added. diff --git a/spec/classes/trove_api_spec.rb b/spec/classes/trove_api_spec.rb index b0efbfe1..23aa8c45 100644 --- a/spec/classes/trove_api_spec.rb +++ b/spec/classes/trove_api_spec.rb @@ -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