Merge "Deprecate customization of PATH environment for db sync"

This commit is contained in:
Zuul 2024-03-08 14:37:00 +00:00 committed by Gerrit Code Review
commit a78ccbc6d4
3 changed files with 27 additions and 40 deletions

View File

@ -12,27 +12,34 @@
# to the magnum-dbsync command.
# Defaults to ''
#
# [*exec_path*]
# (Optional) The path to use for finding the magnum-db-manage binary.
# Defaults to '/usr/bin'
#
# [*db_sync_timeout*]
# (Optional) Timeout for the execution of the db_sync
# Defaults to 300
#
# DEPRECATED PARAMETERS
#
# [*exec_path*]
# (Optional) The path to use for finding the magnum-db-manage binary.
# Defaults to undef
#
class magnum::db::sync(
$user = 'magnum',
$extra_params = '',
$exec_path = '/usr/bin',
$db_sync_timeout = 300,
# DEPRECATED PARAMETERS
$exec_path = undef,
) {
include magnum::deps
include magnum::params
if $exec_path != undef {
warning('The exec_path parameter is deprecated and has no effect')
}
exec { 'magnum-db-sync':
command => "magnum-db-manage ${extra_params} upgrade head",
path => $exec_path,
path => ['/bin', '/usr/bin'],
user => $::magnum::params::user,
refreshonly => true,
try_sleep => 5,

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The ``magnum::db::sync::exec_path`` parameter has been deprecated and has
no effect.

View File

@ -9,7 +9,7 @@ describe 'magnum::db::sync' do
it 'runs magnum-db-sync' do
is_expected.to contain_exec('magnum-db-sync').with(
:command => 'magnum-db-manage upgrade head',
:path => '/usr/bin',
:path => ['/bin', '/usr/bin'],
:user => 'magnum',
:refreshonly => 'true',
:try_sleep => 5,
@ -25,17 +25,17 @@ describe 'magnum::db::sync' do
end
describe "overriding params" do
let :params do
{
:extra_params => '--config-file /etc/magnum/magnum.conf',
:db_sync_timeout => 750,
}
end
let :params do
{
:extra_params => '--config-file /etc/magnum/magnum.conf',
:db_sync_timeout => 750,
}
end
it {
it {
is_expected.to contain_exec('magnum-db-sync').with(
:command => 'magnum-db-manage --config-file /etc/magnum/magnum.conf upgrade head',
:path => '/usr/bin',
:path => ['/bin', '/usr/bin'],
:user => 'magnum',
:refreshonly => 'true',
:try_sleep => 5,
@ -48,33 +48,8 @@ describe 'magnum::db::sync' do
:notify => 'Anchor[magnum::dbsync::end]',
:tag => 'openstack-db',
)
}
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 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({