Added double quotes to paths in concat command, so that it does not fail when path of target file contains some blanks.
This commit is contained in:
parent
24906d1bca
commit
a2f625f385
3 changed files with 36 additions and 3 deletions
|
@ -177,7 +177,7 @@ define concat(
|
|||
}
|
||||
|
||||
# remove extra whitespace from string interpolation to make testing easier
|
||||
$command = strip(regsubst("${script_command} -o ${fragdir}/${concat_name} -d ${fragdir} ${warnflag} ${forceflag} ${orderflag} ${newlineflag}", '\s+', ' ', 'G'))
|
||||
$command = strip(regsubst("${script_command} -o \"${fragdir}/${concat_name}\" -d \"${fragdir}\" ${warnflag} ${forceflag} ${orderflag} ${newlineflag}", '\s+', ' ', 'G'))
|
||||
|
||||
# if puppet is running as root, this exec should also run as root to allow
|
||||
# the concatfragments.sh script to potentially be installed in path that
|
||||
|
|
33
spec/acceptance/quoted_paths_spec.rb
Normal file
33
spec/acceptance/quoted_paths_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'quoted paths' do
|
||||
before(:all) do
|
||||
shell('rm -rf "/tmp/concat test" /var/lib/puppet/concat')
|
||||
shell('mkdir -p "/tmp/concat test"')
|
||||
end
|
||||
|
||||
context 'path with blanks' do
|
||||
pp = <<-EOS
|
||||
concat { '/tmp/concat test/foo':
|
||||
}
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/concat test/foo',
|
||||
content => 'string1',
|
||||
}
|
||||
concat::fragment { '2':
|
||||
target => '/tmp/concat test/foo',
|
||||
content => 'string2',
|
||||
}
|
||||
EOS
|
||||
|
||||
it 'applies the manifest twice with no stderr' do
|
||||
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
|
||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||
end
|
||||
|
||||
describe file('/tmp/concat test/foo') do
|
||||
it { should be_file }
|
||||
it { should contain "string1\nsring2" }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -81,8 +81,8 @@ describe 'concat', :type => :define do
|
|||
end
|
||||
|
||||
cmd = "#{concatdir}/bin/concatfragments.sh " +
|
||||
"-o #{concatdir}/#{safe_name}/fragments.concat.out " +
|
||||
"-d #{concatdir}/#{safe_name}"
|
||||
"-o \"#{concatdir}/#{safe_name}/fragments.concat.out\" " +
|
||||
"-d \"#{concatdir}/#{safe_name}\""
|
||||
|
||||
# flag order: fragdir, warnflag, forceflag, orderflag, newlineflag
|
||||
if p.has_key?(:warn)
|
||||
|
|
Loading…
Reference in a new issue