Allow setting of the DB sync command path
The magnum-db-manage command is not necessarily located under /usr/bin if Magnum is installed in e.g. a virtualenv. In cases like this, it is useful to let the module user specify a different path, such as the bin directory of a virtualenv. Change-Id: I0687683558a4a9ed445642b36b2ce7b7075e49f7
This commit is contained in:
parent
0f8b9f024e
commit
f739aa363b
|
@ -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,
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue