Allow customization of db sync command line

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

Change-Id: Id9de1022481fbeedc3db78a3dd2e3c5f2a962e10
Partial-bug: #1472740
This commit is contained in:
Nate Potter 2015-11-03 17:07:19 +00:00
parent 1ac41b7b1f
commit 4d4430efd6
3 changed files with 31 additions and 5 deletions

View File

@ -1,13 +1,23 @@
#
# Class to execute heat dbsync
#
class heat::db::sync {
# ==Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to append
# to the heat-manage db_sync command. These will be inserted
# in the command line between 'heat-manage' and 'db_sync'.
# Defaults to '--config-file /etc/heat/heat.conf'
#
class heat::db::sync(
$extra_params = '--config-file /etc/heat/heat.conf',
) {
include ::heat::deps
include ::heat::params
exec { 'heat-dbsync':
command => $::heat::params::dbsync_command,
command => "heat-manage ${extra_params} db_sync",
path => '/usr/bin',
user => 'heat',
refreshonly => true,

View File

@ -4,9 +4,6 @@
#
class heat::params {
$dbsync_command =
'heat-manage --config-file /etc/heat/heat.conf db_sync'
case $::osfamily {
'RedHat': {
# package names

View File

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