Allow customization of db sync command line

Add parameter to ceilometer::db::sync class to allow end
users to add command line parameters to the db sync command.

Change-Id: I664a822ef2962d5cb32bef7573e13f0b57ee6057
Partial-bug: #1472740
changes/76/241276/2
Nate Potter 7 years ago
parent fb936e5409
commit fa33bb0ad6
  1. 13
      manifests/db/sync.pp
  2. 20
      spec/classes/ceilometer_db_sync_spec.rb

@ -1,7 +1,16 @@
#
# Class to execute ceilometer dbsync
#
class ceilometer::db::sync {
# == Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters
# to append to the ceilometer-dbsync command.
# Defaults to undef
#
class ceilometer::db::sync(
$extra_params = undef,
) {
include ::ceilometer::params
@ -12,7 +21,7 @@ class ceilometer::db::sync {
Ceilometer_config<| title == 'database/connection' |> ~> Exec['ceilometer-dbsync']
exec { 'ceilometer-dbsync':
command => $::ceilometer::params::dbsync_command,
command => "${::ceilometer::params::dbsync_command} ${extra_params}",
path => '/usr/bin',
user => $::ceilometer::params::user,
refreshonly => true,

@ -6,7 +6,7 @@ describe 'ceilometer::db::sync' do
it 'runs ceilometer-dbsync' do
is_expected.to contain_exec('ceilometer-dbsync').with(
:command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
:command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf ',
:path => '/usr/bin',
:refreshonly => 'true',
:user => 'ceilometer',
@ -14,8 +14,26 @@ describe 'ceilometer::db::sync' do
)
end
describe 'overriding extra_params' do
let :params do
{
:extra_params => '--config-file=/etc/ceilometer/ceilometer_01.conf',
}
end
it { is_expected.to contain_exec('ceilometer-dbsync').with(
:command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf --config-file=/etc/ceilometer/ceilometer_01.conf',
:path => '/usr/bin',
:user => 'ceilometer',
:refreshonly => 'true',
:logoutput => 'on_failure'
)
}
end
end
context 'on a RedHat osfamily' do
let :facts do
{

Loading…
Cancel
Save