19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'vendor_modules/concat/manifests/fragment.pp', line 19
define concat::fragment (
String $target,
Optional[Any] $content = undef,
Optional[Variant[String, Array]] $source = undef,
Variant[String, Integer] $order = '10',
) {
$resource = 'Concat::Fragment'
if ($order =~ String and $order =~ /[:\n\/]/) {
fail("${resource}['${title}']: 'order' cannot contain '/', ':', or '\\n'.")
}
if ! ($content or $source) {
crit('No content, source or symlink specified')
} elsif ($content and $source) {
fail("${resource}['${title}']: Can't use 'source' and 'content' at the same time.")
}
# $serverversion is empty on 'puppet apply' runs. Just use clientversion.
$_serverversion = getvar('serverversion') ? {
undef => $clientversion,
default => $serverversion,
}
if versioncmp($clientversion, '6.0') >= 0 and versioncmp($_serverversion, '6.0') >= 0 {
assert_type(Optional[Variant[String, Deferred]], $content)
} else {
assert_type(Optional[String], $content)
}
$safe_target_name = regsubst($target, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'GM')
concat_fragment { $name:
target => $target,
tag => $safe_target_name,
order => $order,
content => $content,
source => $source,
}
}
|