1 # Creates a concat_fragment in the catalogue
3 # @param target The file that these fragments belong to
4 # @param content If present puts the content into the file
5 # @param source If content was not specified, use the source
7 # By default all files gets a 10_ prefix in the directory you can set it to
8 # anything else using this to influence the order of the content in the file
10 define concat::fragment(
12 Optional[String] $content = undef,
13 Optional[Variant[String, Array]] $source = undef,
14 Variant[String, Integer] $order = '10',
16 $resource = 'Concat::Fragment'
18 if (is_string($order) and $order =~ /[:\n\/]/) {
19 fail("${resource}['${title}']: 'order' cannot contain '/', ':', or '\n'.")
22 if ! ($content or $source) {
23 crit('No content, source or symlink specified')
24 } elsif ($content and $source) {
25 fail("${resource}['${title}']: Can't use 'source' and 'content' at the same time.")
28 $safe_target_name = regsubst($target, '[/:~\n\s\+\*\(\)@]', '_', 'GM')
30 concat_fragment { $name:
32 tag => $safe_target_name,