Allow customization of db sync command line

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

Change-Id: I14c177f3df9cd541408ee033638be21fa6e2fb6a
Partial-bug: #1472740
This commit is contained in:
Nate Potter 2015-11-03 16:41:30 +00:00
parent e84888d83e
commit b63d071d62
3 changed files with 30 additions and 3 deletions

View File

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

View File

@ -3,7 +3,6 @@
# Parameters for puppet-sahara
#
class sahara::params {
$dbmanage_command = 'sahara-db-manage --config-file /etc/sahara/sahara.conf upgrade head'
$client_package_name = 'python-saharaclient'
case $::osfamily {

View File

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