Allow customization of db sync command line

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

Change-Id: I34d9de89aae007d6b9f8644a8ba936bc0cf0c04c
Partial-bug: #1472740
This commit is contained in:
Nate Potter 2015-11-02 18:31:54 +00:00
parent 813331f051
commit 8a1e5f96b3
2 changed files with 32 additions and 3 deletions

View File

@ -1,7 +1,17 @@
#
# Class to execute cinder dbsync
#
class cinder::db::sync {
# == Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to append
# to the cinder-manage db sync command. These will be inserted
# in the command line between 'cinder-manage' and 'db sync'.
# Defaults to undef
#
class cinder::db::sync(
$extra_params = undef,
) {
include ::cinder::params
@ -12,7 +22,7 @@ class cinder::db::sync {
Cinder_config <| title == 'database/connection' |> ~> Exec['cinder-manage db_sync']
exec { 'cinder-manage db_sync':
command => $::cinder::params::db_sync_command,
command => "cinder-manage ${extra_params} db sync",
path => '/usr/bin',
user => 'cinder',
refreshonly => true,

View File

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