db sync: Add native parameter for --skip-gnocchi-resource-types

The --skip-gnocchi-resource-types option is required in case gnocchi is
not used as metric backend. Add the native class parameter so that
users can enable this option more easily.

Change-Id: I10b09b12c0ab93c68b3d1ad215730b882736b1cf
This commit is contained in:
Takashi Kajinami 2024-05-02 18:42:33 +09:00
parent a20047d795
commit 301f5df8b4
3 changed files with 22 additions and 6 deletions

View File

@ -13,16 +13,26 @@
# (Optional) Timeout for the execution of the db_sync
# Defaults to 300
#
# [*skip_gnocchi_resource_types*]
# (Optional) Skip gnocchi resource-types upgrade.
# Defaults to false
#
class ceilometer::db::sync(
$extra_params = undef,
$db_sync_timeout = 300,
$extra_params = undef,
$db_sync_timeout = 300,
Boolean $skip_gnocchi_resource_types = false,
) {
include ceilometer::deps
include ceilometer::params
$skip_opt = $skip_gnocchi_resource_types ? {
true => '--skip-gnocchi-resource-types ',
default => ''
}
exec { 'ceilometer-upgrade':
command => "${::ceilometer::params::dbsync_command} ${extra_params}",
command => "${::ceilometer::params::dbsync_command} ${skip_opt}${extra_params}",
path => '/usr/bin',
user => $::ceilometer::params::user,
refreshonly => true,

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``ceilometer::db::sync::skip_gnocchi_resource_types`` parameter has
been added.

View File

@ -27,13 +27,14 @@ describe 'ceilometer::db::sync' do
describe 'overriding params' do
let :params do
{
:extra_params => '--config-file=/etc/ceilometer/ceilometer_01.conf',
:db_sync_timeout => 750,
:extra_params => '--config-file=/etc/ceilometer/ceilometer_01.conf',
:skip_gnocchi_resource_types => true,
:db_sync_timeout => 750,
}
end
it { is_expected.to contain_exec('ceilometer-upgrade').with(
:command => 'ceilometer-upgrade --config-file=/etc/ceilometer/ceilometer_01.conf',
:command => 'ceilometer-upgrade --skip-gnocchi-resource-types --config-file=/etc/ceilometer/ceilometer_01.conf',
:path => '/usr/bin',
:user => 'ceilometer',
:refreshonly => 'true',