Skip to content

Eliminate Workaround for Sensitive Data; require puppetlabs/concat 7.4; require puppet 7.9 #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
@@ -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,
}
}
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -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",
2 changes: 1 addition & 1 deletion spec/defines/userlist_spec.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions templates/haproxy_userlist_block.epp
Original file line number Diff line number Diff line change
@@ -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 %>
<%-
}
}