88Puppet ::Type . newtype ( :concat_file ) do
99 @doc = <<-DOC
1010 @summary
11- Generates a file with content from fragments sharing a common unique tag.
11+ Generates a file with content from fragments sharing a single or a list of common unique tag(s) .
1212
1313 @example
1414 Concat_fragment <<| tag == 'unique_tag' |>>
15+ Concat_fragment <<| tag == 'other_tag' |>>
1516
1617 concat_file { '/tmp/file':
1718 tag => 'unique_tag', # Optional. Default to undef
1819 path => '/tmp/file', # Optional. If given it overrides the resource name
1920 owner => 'root', # Optional. Default to undef
2021 group => 'root', # Optional. Default to undef
21- mode => '0644' # Optional. Default to undef
22- order => 'numeric' # Optional, Default to 'numeric'
22+ mode => '0644', # Optional. Default to undef
23+ order => 'numeric', # Optional, Default to 'numeric'
2324 ensure_newline => false # Optional, Defaults to false
2425 }
26+ concat_file { '/tmp/file2':
27+ tag => ['unique_tag', 'other_tag'],
28+ path => '/tmp/file2',
29+ owner => 'root',
30+ group => 'root',
31+ mode => '0644',
32+ order => 'numeric',
33+ ensure_newline => false
34+ }
2535 DOC
2636
2737 ensurable do
@@ -40,7 +50,7 @@ def exists?
4050 end
4151
4252 newparam ( :tag ) do
43- desc 'Required. Specifies a unique tag reference to collect all concat_fragments with the same tag.'
53+ desc 'Specifies a single or a list of unique tag reference(s) to collect all concat_fragments with the same tag(s) .'
4454 end
4555
4656 newparam ( :path , namevar : true ) do
@@ -194,7 +204,7 @@ def fragments
194204 next unless resource . is_a? ( Puppet ::Type . type ( :concat_fragment ) )
195205
196206 if resource [ :target ] == self [ :path ] || resource [ :target ] == title ||
197- ( resource [ :tag ] && resource [ :tag ] == self [ :tag ] )
207+ ( ( resource [ :tag ] && self [ :tag ] ) && ( resource [ :tag ] == self [ :tag ] || self [ :tag ] . is_a? ( Array ) && self [ :tag ] . include? ( resource [ :tag ] ) ) )
198208 resource
199209 end
200210 } . compact
0 commit comments