allow source param to concat::fragment to be a string or an Array

This is resolve a regression preventing an array of string(s) being passed to the fragment file resource's source parameter.
This commit is contained in:
Joshua Hoblitt 2013-11-12 23:16:47 -07:00
parent 527c266997
commit ba9501c1a0
2 changed files with 5 additions and 3 deletions

View file

@ -38,7 +38,9 @@ define concat::fragment(
validate_string($target)
validate_re($ensure, '^$|^present$|^absent$|^file$|^directory$')
validate_string($content)
validate_string($source)
if !(is_string($source) or is_array($source)) {
fail('$source is not a string or an Array.')
}
validate_string($order)
if $mode {
warning('The $mode parameter to concat::fragment is deprecated and has no effect')

View file

@ -111,7 +111,7 @@ describe 'concat::fragment', :type => :define do
end # content =>
context 'source =>' do
['', '/foo/bar'].each do |source|
['', '/foo/bar', ['/foo/bar', '/foo/baz']].each do |source|
context source do
it_behaves_like 'fragment', 'motd_header', {
:source => source,
@ -126,7 +126,7 @@ describe 'concat::fragment', :type => :define do
let(:params) {{ :source => false, :target => '/etc/motd' }}
it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /is not a string/)
expect { should }.to raise_error(Puppet::Error, /is not a string or an Array/)
end
end
end # source =>