Skip to content

Commit 06e8157

Browse files
committed
Fixes command
Correct command is `test -e $filename` Also % replacement in validate_cmd is not supported in a released version of puppetlabs-stdlib, it's fixed in 4.5.x but not not released yet (See: puppetlabs/puppetlabs-stdlib#377)
1 parent b5c7ee9 commit 06e8157

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
}
197197
}
198198
else {
199-
validate_cmd("${fragdir}/${concat_name}", $validate_cmd)
199+
fail("validate_cmd is a limted to Puppet > 3.5, you are on ${::puppetversion}")
200200
}
201201
}
202202

spec/unit/defines/concat_spec.rb

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
:replace => true,
2020
:order => 'alpha',
2121
:ensure_newline => false,
22-
:validate_cmd => nil,
2322
}.merge(params)
2423

2524
safe_name = title.gsub('/', '_')
@@ -391,19 +390,28 @@
391390
end
392391

393392
context '/usr/bin/test -e' do
394-
it_behaves_like 'concat', '/etc/foo.bar', { :validate_cmd => '/usr/bin/test % -e' }
395-
end
396-
397-
[ 1234, true ].each do |cmd|
398-
context cmd do
393+
if (Puppet.version >= '3.5.0')
394+
let(:facts) {{ :puppetversion => Puppet.version }}
395+
it_behaves_like 'concat', '/etc/foo.bar', { :validate_cmd => '/usr/bin/test -e' }
396+
else
399397
let(:title) { '/etc/foo.bar' }
400-
let(:params) {{ :validate_cmd => cmd }}
398+
let(:facts) {
399+
{
400+
:puppetversion => Puppet.version,
401+
:concat_basedir => '/var/lib/puppet/concat',
402+
}
403+
}
404+
let(:params) {
405+
{
406+
:validate_cmd => '/usr/bin/test -e'
407+
}
408+
}
401409
it 'should fail' do
402-
expect { should }.to raise_error(Puppet::Error, /\$validate_cmd must be a string/)
410+
expect { should }.to raise_error(/validate_cmd is a limted to Puppet > 3.5, you are on/)
403411
end
404412
end
405413
end
406-
end # validate_cmd =>
414+
end
407415

408416
describe 'deprecated parameter' do
409417
context 'gnu =>' do

0 commit comments

Comments
 (0)