From b8fbb5c8cb0785180f28cd89a718e04b971ac237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Mo=CC=88ding?= Date: Thu, 20 Apr 2023 18:47:04 +0200 Subject: [PATCH] Replace empty string parameter with an undef value --- manifests/mc/define.pp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/manifests/mc/define.pp b/manifests/mc/define.pp index 9fcd13b..0deab88 100644 --- a/manifests/mc/define.pp +++ b/manifests/mc/define.pp @@ -11,20 +11,20 @@ # use_quotes => false, # } # -# @param macro_name The name of the macro that will be defined. This will be -# the first argument of the m4 define builtin. **Note**: The macro name -# should not be quoted as it will always be quoted in the template. -# # @param expansion The expansion defined for the macro. # # @param use_quotes A boolean that indicates if the expansion should be # quoted (using m4 quotes). Valid options: `true` or `false`. # +# @param macro_name The name of the macro that will be defined. This will be +# the first argument of the m4 define builtin. **Note**: The macro name +# should not be quoted as it will always be quoted in the template. +# # define sendmail::mc::define ( - String $macro_name = $name, - Boolean $use_quotes = true, - Variant[String,Integer] $expansion = '', + Optional[Variant[String,Integer]] $expansion = undef, + Boolean $use_quotes = true, + String $macro_name = $name, ) { case $macro_name { /^confLDAP/: { @@ -45,7 +45,10 @@ } # Add quotes to the expansion if needed - $exp = bool2str($use_quotes, "`${expansion}'", String($expansion)) + $exp = ($expansion =~ Undef) ? { + true => "`'", + default => bool2str($use_quotes, "`${expansion}'", String($expansion)), + } concat::fragment { "sendmail_mc-define-${title}": target => 'sendmail.mc',