X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fconcat%2Fmanifests%2Ffragment.pp;h=e30732ca8cd2e33099a944c1f04ae28a3794ac3b;hb=7c041353f4da829d409830eba2e95946952e817f;hp=9cfae6613e23c10ef0d476a85fff9914e989bf37;hpb=23d29143ac40015ce61cf83a4067466f8f7d66dc;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/concat/manifests/fragment.pp b/3rdparty/modules/concat/manifests/fragment.pp index 9cfae6613..e30732ca8 100644 --- a/3rdparty/modules/concat/manifests/fragment.pp +++ b/3rdparty/modules/concat/manifests/fragment.pp @@ -1,52 +1,34 @@ -# == Define: concat::fragment -# # Creates a concat_fragment in the catalogue # -# === Options: -# -# [*target*] -# The file that these fragments belong to -# [*content*] -# If present puts the content into the file -# [*source*] -# If content was not specified, use the source -# [*order*] +# @param target The file that these fragments belong to +# @param content If present puts the content into the file +# @param source If content was not specified, use the source +# @param order # By default all files gets a 10_ prefix in the directory you can set it to # anything else using this to influence the order of the content in the file # define concat::fragment( - $target, - $ensure = undef, - $content = undef, - $source = undef, - $order = '10', + String $target, + Optional[String] $content = undef, + Optional[Variant[String, Array]] $source = undef, + Variant[String, Integer] $order = '10', ) { - validate_string($target) - - if $ensure != undef { - warning('The $ensure parameter to concat::fragment is deprecated and has no effect.') - } - - validate_string($content) - if !(is_string($source) or is_array($source)) { - fail('$source is not a string or an Array.') - } + $resource = 'Concat::Fragment' - if !(is_string($order) or is_integer($order)) { - fail('$order is not a string or integer.') - } elsif (is_string($order) and $order =~ /[:\n\/]/) { - fail("Order cannot contain '/', ':', or '\n'.") + if (is_string($order) 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("Can't use 'source' and 'content' at the same time") + fail("${resource}['${title}']: Can't use 'source' and 'content' at the same time.") } - $safe_target_name = regsubst($target, '[/:\n\s]', '_', 'GM') + $safe_target_name = regsubst($target, '[/:~\n\s\+\*\(\)@]', '_', 'GM') concat_fragment { $name: + target => $target, tag => $safe_target_name, order => $order, content => $content,