Skip to content

Commit

Permalink
Rename tagging parameter for defined types concat and concat::fragment
Browse files Browse the repository at this point in the history
avoid potential problems and warnings by overlapping with the
metaparameter "tag"
  • Loading branch information
Lightning- committed Jun 4, 2024
1 parent d4d8399 commit 95ad14d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions manifests/fragment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
# @param target
# Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource.
#
# @param tag
# @param tagging
# Specifies a custom tag to use for the fragment.
#
define concat::fragment (
String $target,
Optional[Variant[Sensitive[String], String, Deferred]] $content = undef,
Optional[Variant[String, Array]] $source = undef,
Optional[String[1]] $tag = undef,
Optional[String[1]] $tagging = undef,
Variant[String, Integer] $order = '10',
) {
$resource = 'Concat::Fragment'
Expand All @@ -38,10 +38,10 @@
fail("${resource}['${title}']: Can't use 'source' and 'content' at the same time.")
}

if $tag =~ Undef {
if $tagging =~ Undef {
$safe_target_name = regsubst($target, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'GM')
} else {
$safe_target_name = $tag
$safe_target_name = $tagging
}

concat_fragment { $name:
Expand Down
12 changes: 6 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
# @param create_empty_file
# Specifies whether to create an empty file if no fragments are defined. Defaults to true.
#
# @param tag
# Specifies a custom tag or list of custom tags for gatherinng the fragments to combine.
# @param tagging
# Specifies a custom tag or list of custom tags for gathering the fragments to combine.
#
define concat (
Enum['present', 'absent'] $ensure = 'present',
Expand All @@ -105,8 +105,8 @@
Optional[String] $seluser = undef,
Boolean $force = false,
Boolean $create_empty_file = true,
Enum['plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'] $format = 'plain',
Optional[Variant[String[1], Array[String[1], 1]]] $tag = undef,
Enum['plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'] $format = 'plain',
Optional[Variant[String[1], Array[String[1], 1]]] $tagging = undef,
) {
$safe_name = regsubst($name, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'G')
$default_warn_message = "# This file is managed by Puppet. DO NOT EDIT.\n"
Expand All @@ -126,10 +126,10 @@
}
}

if $tag =~ Undef {
if $tagging =~ Undef {
$safe_names = $safe_name
} else {
$safe_names = flatten($safe_name, $tag)
$safe_names = flatten($safe_name, $tagging)
}

if $ensure == 'present' {
Expand Down

0 comments on commit 95ad14d

Please sign in to comment.