diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 4703cf90..931339a4 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -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, diff --git a/manifests/params.pp b/manifests/params.pp index d8b4830e..3f66c953 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,9 +4,6 @@ # class heat::params { - $dbsync_command = - 'heat-manage --config-file /etc/heat/heat.conf db_sync' - case $::osfamily { 'RedHat': { # package names diff --git a/spec/classes/heat_db_sync_spec.rb b/spec/classes/heat_db_sync_spec.rb index e88da806..31314935 100644 --- a/spec/classes/heat_db_sync_spec.rb +++ b/spec/classes/heat_db_sync_spec.rb @@ -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 {