Remove redundant spaces from cron commands
Change-Id: If545538c53677d4979e6f260a1f84caeea565c68
This commit is contained in:
parent
5b135ed130
commit
508b9f7fe5
@ -96,21 +96,21 @@ class nova::cron::archive_deleted_rows (
|
|||||||
include nova::params
|
include nova::params
|
||||||
|
|
||||||
if $until_complete {
|
if $until_complete {
|
||||||
$until_complete_real = '--until-complete'
|
$until_complete_real = ' --until-complete'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$until_complete_real = ''
|
$until_complete_real = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
if $purge {
|
if $purge {
|
||||||
$purge_real = '--purge'
|
$purge_real = ' --purge'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$purge_real = ''
|
$purge_real = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
if $all_cells {
|
if $all_cells {
|
||||||
$all_cells_real = '--all-cells'
|
$all_cells_real = ' --all-cells'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$all_cells_real = ''
|
$all_cells_real = ''
|
||||||
@ -123,7 +123,7 @@ class nova::cron::archive_deleted_rows (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $age {
|
if $age {
|
||||||
$age_real = "--before `date --date=\'today - ${age} days\' +\\%F`"
|
$age_real = " --before `date --date=\'today - ${age} days\' +\\%F`"
|
||||||
} else {
|
} else {
|
||||||
$age_real = ''
|
$age_real = ''
|
||||||
}
|
}
|
||||||
@ -131,8 +131,8 @@ class nova::cron::archive_deleted_rows (
|
|||||||
$cron_cmd = 'nova-manage db archive_deleted_rows'
|
$cron_cmd = 'nova-manage db archive_deleted_rows'
|
||||||
|
|
||||||
cron { '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} \
|
command => "${sleep}${cron_cmd}${purge_real} --max_rows ${max_rows}${age_real}${until_complete_real}${all_cells_real} \
|
||||||
${all_cells_real} >>${destination} 2>&1",
|
>>${destination} 2>&1",
|
||||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
user => pick($user, $::nova::params::nova_user),
|
user => pick($user, $::nova::params::nova_user),
|
||||||
minute => $minute,
|
minute => $minute,
|
||||||
|
@ -79,14 +79,14 @@ class nova::cron::purge_shadow_tables (
|
|||||||
include nova::params
|
include nova::params
|
||||||
|
|
||||||
if $verbose {
|
if $verbose {
|
||||||
$verbose_real = '--verbose'
|
$verbose_real = ' --verbose'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$verbose_real = ''
|
$verbose_real = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
if $all_cells {
|
if $all_cells {
|
||||||
$all_cells_real = '--all-cells'
|
$all_cells_real = ' --all-cells'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$all_cells_real = ''
|
$all_cells_real = ''
|
||||||
@ -101,8 +101,8 @@ class nova::cron::purge_shadow_tables (
|
|||||||
$cron_cmd = 'nova-manage db purge'
|
$cron_cmd = 'nova-manage db purge'
|
||||||
|
|
||||||
cron { 'nova-manage db purge':
|
cron { 'nova-manage db purge':
|
||||||
command => "${sleep}${cron_cmd} --before `date --date='today - ${age} days' +\\%D` ${verbose_real} \
|
command => "${sleep}${cron_cmd} --before `date --date='today - ${age} days' +\\%D`${verbose_real}${all_cells_real} \
|
||||||
${all_cells_real} >>${destination} 2>&1",
|
>>${destination} 2>&1",
|
||||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
user => pick($user, $::nova::params::nova_user),
|
user => pick($user, $::nova::params::nova_user),
|
||||||
minute => $minute,
|
minute => $minute,
|
||||||
|
@ -59,7 +59,7 @@ describe 'basic nova' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe cron do
|
describe cron do
|
||||||
it { is_expected.to have_entry('1 0 * * * nova-manage db archive_deleted_rows --max_rows 100 >>/var/log/nova/nova-rowsflush.log 2>&1').with_user('nova') }
|
it { is_expected.to have_entry('1 0 * * * nova-manage db archive_deleted_rows --max_rows 100 >>/var/log/nova/nova-rowsflush.log 2>&1').with_user('nova') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'nova aggregate' do
|
describe 'nova aggregate' do
|
||||||
|
@ -22,7 +22,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
context 'until_complete and all_cells is false' do
|
context 'until_complete and all_cells is false' do
|
||||||
it 'configures a cron without until_complete and all_cells' do
|
it 'configures a cron without until_complete and all_cells' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -44,7 +44,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
|
|
||||||
it 'configures a cron with until_complete' do
|
it 'configures a cron with until_complete' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --until-complete >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --until-complete >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -66,7 +66,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
|
|
||||||
it 'configures a cron with all_cells' do
|
it 'configures a cron with all_cells' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --all-cells >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --all-cells >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -88,7 +88,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
|
|
||||||
it 'configures a cron with purge' do
|
it 'configures a cron with purge' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "nova-manage db archive_deleted_rows --purge --max_rows #{params[:max_rows]} >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db archive_deleted_rows --purge --max_rows #{params[:max_rows]} >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -111,7 +111,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
|
|
||||||
it 'configures a cron with all purge params' do
|
it 'configures a cron with all purge params' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "nova-manage db archive_deleted_rows --purge --max_rows #{params[:max_rows]} --until-complete >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db archive_deleted_rows --purge --max_rows #{params[:max_rows]} --until-complete >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -133,7 +133,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
|
|
||||||
it 'configures a cron with maxdelay' do
|
it 'configures a cron with maxdelay' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} >>#{params[:destination]} 2>&1",
|
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -155,7 +155,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
|
|
||||||
it 'configures a cron with --before' do
|
it 'configures a cron with --before' do
|
||||||
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
|
||||||
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --before `date --date='today - #{params[:age]} days' +\\%F` >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --before `date --date='today - #{params[:age]} days' +\\%F` >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
|
@ -26,7 +26,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
|||||||
|
|
||||||
it 'configures a nova purge cron with verbose output' do
|
it 'configures a nova purge cron with verbose output' do
|
||||||
is_expected.to contain_cron('nova-manage db purge').with(
|
is_expected.to contain_cron('nova-manage db purge').with(
|
||||||
:command => "nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` --verbose >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` --verbose >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -48,7 +48,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
|||||||
|
|
||||||
it 'configures a nova purge cron without verbose output' do
|
it 'configures a nova purge cron without verbose output' do
|
||||||
is_expected.to contain_cron('nova-manage db purge').with(
|
is_expected.to contain_cron('nova-manage db purge').with(
|
||||||
:command => "nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -70,7 +70,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
|||||||
|
|
||||||
it 'configures a nova purge cron with all cells enabled' do
|
it 'configures a nova purge cron with all cells enabled' do
|
||||||
is_expected.to contain_cron('nova-manage db purge').with(
|
is_expected.to contain_cron('nova-manage db purge').with(
|
||||||
:command => "nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` --all-cells >>#{params[:destination]} 2>&1",
|
:command => "nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` --all-cells >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
@ -92,7 +92,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
|||||||
|
|
||||||
it 'configures a nova purge cron with maxdelay' do
|
it 'configures a nova purge cron with maxdelay' do
|
||||||
is_expected.to contain_cron('nova-manage db purge').with(
|
is_expected.to contain_cron('nova-manage db purge').with(
|
||||||
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` >>#{params[:destination]} 2>&1",
|
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` >>#{params[:destination]} 2>&1",
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
:user => params[:user],
|
:user => params[:user],
|
||||||
:minute => params[:minute],
|
:minute => params[:minute],
|
||||||
|
Loading…
Reference in New Issue
Block a user