Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions manifests/userlist.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -64,6 +62,6 @@
concat::fragment { "${instance_name}-${section_name}_userlist_block":
order => "12-${section_name}-00",
target => $_config_file,
content => $_content,
content => $content,
}
}
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/userlist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions templates/haproxy_userlist_block.epp
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
<%-
}
}
Expand Down