diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index dad9515b..8fec73b9 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -1,7 +1,16 @@ # # Class to execute ironic dbsync # -class ironic::db::sync { +# == Parameters +# +# [*extra_params*] +# (optional) String of extra command line parameters to append +# to the ironic-dbsync command. +# Defaults to undef +# +class ironic::db::sync( + $extra_params = undef, +) { include ::ironic::params @@ -12,7 +21,7 @@ class ironic::db::sync { Ironic_config<| title == 'database/connection' |> ~> Exec['ironic-dbsync'] exec { 'ironic-dbsync': - command => $::ironic::params::dbsync_command, + command => "${::ironic::params::dbsync_command} ${extra_params}", path => '/usr/bin', # Ubuntu packaging is running dbsync command as root during ironic-common # postinstall script so when Puppet tries to run dbsync again, it fails diff --git a/spec/classes/ironic_db_sync_spec.rb b/spec/classes/ironic_db_sync_spec.rb index 328db914..8d68361d 100644 --- a/spec/classes/ironic_db_sync_spec.rb +++ b/spec/classes/ironic_db_sync_spec.rb @@ -6,7 +6,7 @@ describe 'ironic::db::sync' do it 'runs ironic-manage db_sync' do is_expected.to contain_exec('ironic-dbsync').with( - :command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf', + :command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf ', :path => '/usr/bin', :user => 'root', :refreshonly => 'true', @@ -14,8 +14,24 @@ describe 'ironic::db::sync' do ) end + describe "overriding extra_params" do + let :params do + { + :extra_params => '--config-file /etc/ironic/ironic_01.conf', + } + end + it { is_expected.to contain_exec('ironic-dbsync').with( + :command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf --config-file /etc/ironic/ironic_01.conf', + :path => '/usr/bin', + :user => 'root', + :refreshonly => true, + :logoutput => 'on_failure' + ) + } + end end + context 'on a RedHat osfamily' do let :facts do {