diff --git a/manifests/userlist.pp b/manifests/userlist.pp index 7c40696e..ac758b8a 100644 --- a/manifests/userlist.pp +++ b/manifests/userlist.pp @@ -50,8 +50,6 @@ epp_section_name => $section_name, }, ) - # we have to unwrap here, as "concat" cannot handle Sensitive Data - $_content = if $content =~ Sensitive { $content.unwrap } else { $content } if $instance == 'haproxy' { $instance_name = 'haproxy' @@ -64,6 +62,6 @@ concat::fragment { "${instance_name}-${section_name}_userlist_block": order => "12-${section_name}-00", target => $_config_file, - content => $_content, + content => $content, } } diff --git a/metadata.json b/metadata.json index f8f5b6e5..33e6213c 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/concat", - "version_requirement": ">= 1.2.3 < 10.0.0" + "version_requirement": ">= 7.4.0 < 10.0.0" } ], "operatingsystem_support": [ @@ -76,7 +76,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 9.0.0" + "version_requirement": ">= 7.9.0 < 9.0.0" } ], "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", diff --git a/spec/defines/userlist_spec.rb b/spec/defines/userlist_spec.rb index 0c06c45b..8e1233f3 100644 --- a/spec/defines/userlist_spec.rb +++ b/spec/defines/userlist_spec.rb @@ -36,7 +36,7 @@ is_expected.to contain_concat__fragment('haproxy-admins_userlist_block').with( 'order' => '12-admins-00', 'target' => '/etc/haproxy/haproxy.cfg', - 'content' => "\nuserlist admins\n group superadmins users kitchen scott\n group megaadmins users kitchen\n user scott insecure-password elgato\n user kitchen insecure-password foobar\n", + 'content' => sensitive("\nuserlist admins\n group superadmins users kitchen scott\n group megaadmins users kitchen\n user scott insecure-password elgato\n user kitchen insecure-password foobar\n"), # rubocop:disable Layout/LineLength ) } end diff --git a/templates/haproxy_userlist_block.epp b/templates/haproxy_userlist_block.epp index a4a202e5..786bbd12 100644 --- a/templates/haproxy_userlist_block.epp +++ b/templates/haproxy_userlist_block.epp @@ -14,12 +14,9 @@ userlist <%= $epp_section_name %> } } $epp_users.each |Variant[String, Sensitive[String]] $user| { - # TODO: remove this Workaround, as soon as Function empty() can handle - # Sensitive (Pullrequest pending) - $user_unsensitive = if $user =~ Sensitive { $user.unwrap } else { $user } - unless $user_unsensitive.empty { + unless $user.empty { -%> - user <%= $user_unsensitive %> + user <%= $user %> <%- } }