Allow customization of db sync command line
Add parameter to nova::db::sync class to allow end users to add command line parameters to the db sync command. Change-Id: I89dea475495d5903d953ff4492ad2e0f12a293c1 Partial-bug: #1472740
This commit is contained in:
parent
67c71095bf
commit
1b965fd70b
|
@ -1,7 +1,17 @@
|
|||
#
|
||||
# Class to execute nova dbsync
|
||||
#
|
||||
class nova::db::sync {
|
||||
# ==Parameters
|
||||
#
|
||||
# [*extra_params*]
|
||||
# (optional) String of extra command line parameters to append
|
||||
# to the nova-manage db sync command. These will be inserted in
|
||||
# the command line between 'nova-manage' and 'db sync'.
|
||||
# Defaults to undef
|
||||
#
|
||||
class nova::db::sync(
|
||||
$extra_params = undef,
|
||||
) {
|
||||
|
||||
include ::nova::params
|
||||
|
||||
|
@ -14,7 +24,7 @@ class nova::db::sync {
|
|||
Exec<| title == 'post-nova_config' |> ~> Exec['nova-db-sync']
|
||||
|
||||
exec { 'nova-db-sync':
|
||||
command => '/usr/bin/nova-manage db sync',
|
||||
command => "/usr/bin/nova-manage ${extra_params} db sync",
|
||||
refreshonly => true,
|
||||
logoutput => on_failure,
|
||||
}
|
||||
|
|
|
@ -6,14 +6,31 @@ describe 'nova::db::sync' do
|
|||
|
||||
it 'runs nova-db-sync' do
|
||||
is_expected.to contain_exec('nova-db-sync').with(
|
||||
:command => '/usr/bin/nova-manage db sync',
|
||||
:command => '/usr/bin/nova-manage db sync',
|
||||
:refreshonly => 'true',
|
||||
:logoutput => 'on_failure'
|
||||
)
|
||||
end
|
||||
|
||||
describe "overriding extra_params" do
|
||||
let :params do
|
||||
{
|
||||
:extra_params => '--config-file /etc/nova/nova.conf',
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
is_expected.to contain_exec('nova-db-sync').with(
|
||||
:command => '/usr/bin/nova-manage --config-file /etc/nova/nova.conf db sync',
|
||||
:refreshonly => 'true',
|
||||
:logoutput => 'on_failure'
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
context 'on a RedHat osfamily' do
|
||||
let :facts do
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue