Escape date command parameter
Fixed `date` command parameter by escaping % in `nova-manage db purge` command. Change-Id: I1d8fff0a90a2f35687ede46aef9886abf75b1f1f
This commit is contained in:
parent
6ba4a0029e
commit
1eb5ee747d
@ -101,7 +101,7 @@ class nova::cron::purge_shadow_tables (
|
||||
$cron_cmd = '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} >>${destination} 2>&1",
|
||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
user => pick($user, $::nova::params::nova_user),
|
||||
|
@ -26,7 +26,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
||||
|
||||
it 'configures a nova purge cron with verbose output' do
|
||||
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",
|
||||
:user => 'nova',
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
:user => params[:user],
|
||||
@ -49,7 +49,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
||||
|
||||
it 'configures a nova purge cron without verbose output' do
|
||||
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",
|
||||
:user => 'nova',
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
:user => params[:user],
|
||||
@ -95,7 +95,7 @@ describe 'nova::cron::purge_shadow_tables' do
|
||||
|
||||
it 'configures a nova purge cron with maxdelay' do
|
||||
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` --verbose --all-cells >>#{params[:destination]} 2>&1",
|
||||
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; nova-manage db purge --before `date --date='today - #{params[:age]} days' +\\%D` --verbose --all-cells >>#{params[:destination]} 2>&1",
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
:user => params[:user],
|
||||
:minute => params[:minute],
|
||||
|
Loading…
Reference in New Issue
Block a user