Merge pull request #103 from jhoblitt/fragment_source

allow source param to concat::fragment to be a string or an Array
This commit is contained in:
Ashley Penney 2013-11-13 05:26:01 -08:00
commit 5b9ed7093a
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 =>