Skip to content

Commit a2d61e1

Browse files
committed
Add parameter "tag" to concat::fragment
allow a user defined tag for a fragment; keep previous default behavior if not supplied
1 parent cb57ad5 commit a2d61e1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

manifests/fragment.pp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
# @param target
1717
# Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource.
1818
#
19+
# @param tag
20+
# Specifies a custom tag to use for the fragment.
21+
#
1922
define concat::fragment (
2023
String $target,
2124
Optional[Variant[Sensitive[String], String, Deferred]] $content = undef,
2225
Optional[Variant[String, Array]] $source = undef,
26+
Optional[String[1]] $tag = undef,
2327
Variant[String, Integer] $order = '10',
2428
) {
2529
$resource = 'Concat::Fragment'
@@ -34,7 +38,11 @@
3438
fail("${resource}['${title}']: Can't use 'source' and 'content' at the same time.")
3539
}
3640

37-
$safe_target_name = regsubst($target, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'GM')
41+
if $tag =~ Undef {
42+
$safe_target_name = regsubst($target, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'GM')
43+
} else {
44+
$safe_target_name = $tag
45+
}
3846

3947
concat_fragment { $name:
4048
target => $target,

0 commit comments

Comments
 (0)