diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 5a28c75..78c0c84 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -12,16 +12,21 @@ # to the magnum-dbsync command. # Defaults to undef # +# [*exec_path*] +# (optional) The path to use for finding the magnum-db-manage binary. +# Defaults to /usr/bin +# class magnum::db::sync( $user = 'magnum', $extra_params = '--config-file /etc/magnum/magnum.conf', + $exec_path = '/usr/bin', ) { include ::magnum::deps exec { 'magnum-db-sync': command => "magnum-db-manage ${extra_params} upgrade head", - path => '/usr/bin', + path => $exec_path, user => $user, refreshonly => true, try_sleep => 5, diff --git a/spec/classes/magnum_db_sync_spec.rb b/spec/classes/magnum_db_sync_spec.rb index 2819d38..304e2ea 100644 --- a/spec/classes/magnum_db_sync_spec.rb +++ b/spec/classes/magnum_db_sync_spec.rb @@ -44,6 +44,30 @@ describe 'magnum::db::sync' do } end + describe "overriding exec_path" do + let :params do + { + :exec_path => '/opt/venvs/magnum/bin', + } + end + + it { + is_expected.to contain_exec('magnum-db-sync').with( + :command => 'magnum-db-manage --config-file /etc/magnum/magnum.conf upgrade head', + :path => '/opt/venvs/magnum/bin', + :user => 'magnum', + :refreshonly => 'true', + :try_sleep => 5, + :tries => 10, + :logoutput => 'on_failure', + :subscribe => ['Anchor[magnum::install::end]', + 'Anchor[magnum::config::end]', + 'Anchor[magnum::dbsync::begin]'], + :notify => 'Anchor[magnum::dbsync::end]', + ) + } + end + end on_supported_os({