diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 58644243..40552e23 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -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, diff --git a/spec/classes/cinder_db_sync_spec.rb b/spec/classes/cinder_db_sync_spec.rb index 98761d4a..238b0980 100644 --- a/spec/classes/cinder_db_sync_spec.rb +++ b/spec/classes/cinder_db_sync_spec.rb @@ -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 {