From f7dfc6abff5ecba44f7f3d38aad21670454e9faf Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 5 Mar 2024 12:46:38 +0900 Subject: [PATCH] Deprecate customization of PATH environment for db sync Because we currently support installation by packages, we rarely expect that users may need to override this option. Drop the parameter to reduce complexity and make the implementation more consistent across modules. Change-Id: Iecf00bd3e241eb0c96b309dc18d0776c381146ac --- manifests/db/sync.pp | 19 +++++--- ...precate-db_sync-path-9e8f32d73a0722e7.yaml | 5 +++ spec/classes/magnum_db_sync_spec.rb | 43 ++++--------------- 3 files changed, 27 insertions(+), 40 deletions(-) create mode 100644 releasenotes/notes/deprecate-db_sync-path-9e8f32d73a0722e7.yaml diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index a998cd7..d7b8929 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -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, diff --git a/releasenotes/notes/deprecate-db_sync-path-9e8f32d73a0722e7.yaml b/releasenotes/notes/deprecate-db_sync-path-9e8f32d73a0722e7.yaml new file mode 100644 index 0000000..e9a023c --- /dev/null +++ b/releasenotes/notes/deprecate-db_sync-path-9e8f32d73a0722e7.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + The ``magnum::db::sync::exec_path`` parameter has been deprecated and has + no effect. diff --git a/spec/classes/magnum_db_sync_spec.rb b/spec/classes/magnum_db_sync_spec.rb index 938156b..0e602b8 100644 --- a/spec/classes/magnum_db_sync_spec.rb +++ b/spec/classes/magnum_db_sync_spec.rb @@ -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({