diff --git a/manifests/cron/archive_deleted_rows.pp b/manifests/cron/archive_deleted_rows.pp index 9c0d24297..4765a1a05 100644 --- a/manifests/cron/archive_deleted_rows.pp +++ b/manifests/cron/archive_deleted_rows.pp @@ -71,6 +71,10 @@ # (optional) Adds --all-cells to the archive command # Defaults to false. # +# [*task_log*] +# (optional) Adds --task-log to the archive command +# Defaults to false. +# # [*age*] # (optional) Adds a retention policy when purging the shadow tables # Defaults to undef. @@ -89,6 +93,7 @@ class nova::cron::archive_deleted_rows ( $purge = false, $maxdelay = 0, $all_cells = false, + $task_log = false, $age = undef, ) { @@ -116,6 +121,13 @@ class nova::cron::archive_deleted_rows ( $all_cells_real = '' } + if $task_log { + $task_log_real = ' --task-log' + } + else { + $task_log_real = '' + } + if $maxdelay == 0 { $sleep = '' } else { @@ -131,7 +143,7 @@ class nova::cron::archive_deleted_rows ( $cron_cmd = 'nova-manage db archive_deleted_rows' cron { 'nova-manage db archive_deleted_rows': - command => "${sleep}${cron_cmd}${purge_real} --max_rows ${max_rows}${age_real}${until_complete_real}${all_cells_real} \ + command => "${sleep}${cron_cmd}${purge_real} --max_rows ${max_rows}${age_real}${until_complete_real}${all_cells_real}${task_log_real} \ >>${destination} 2>&1", environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh', user => pick($user, $::nova::params::nova_user), diff --git a/releasenotes/notes/archive_deleted_rows-task_log-39777328b2fbd8ee.yaml b/releasenotes/notes/archive_deleted_rows-task_log-39777328b2fbd8ee.yaml new file mode 100644 index 000000000..ff785ec62 --- /dev/null +++ b/releasenotes/notes/archive_deleted_rows-task_log-39777328b2fbd8ee.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + The new ``nova::cron::archive_deleted_rows::task_log`` parameter has been + added. This parameter enables the ``--task-log`` option of + the ``nova-manage archive_deleted_rows`` command so that task logs are also + processed by the command. diff --git a/spec/classes/nova_cron_archive_deleted_rows_spec.rb b/spec/classes/nova_cron_archive_deleted_rows_spec.rb index f09ab5971..e98b56d6c 100644 --- a/spec/classes/nova_cron_archive_deleted_rows_spec.rb +++ b/spec/classes/nova_cron_archive_deleted_rows_spec.rb @@ -16,6 +16,7 @@ describe 'nova::cron::archive_deleted_rows' do :all_cells => false, :age => false, :maxdelay => 0, + :task_log => false, :destination => '/var/log/nova/nova-rowsflush.log' } end @@ -79,6 +80,28 @@ describe 'nova::cron::archive_deleted_rows' do end end + context 'task_log is true' do + before :each do + params.merge!( + :task_log => true, + ) + end + + it 'configures a cron with task_log' do + is_expected.to contain_cron('nova-manage db archive_deleted_rows').with( + :command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --task-log >>#{params[:destination]} 2>&1", + :environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh', + :user => params[:user], + :minute => params[:minute], + :hour => params[:hour], + :monthday => params[:monthday], + :month => params[:month], + :weekday => params[:weekday], + :require => 'Anchor[nova::dbsync::end]', + ) + end + end + context 'purge is true' do before :each do params.merge!(