Skip to content

Commit 3d5f40b

Browse files
committed
Eliminate Workaround for Sensitive Data
"concat" handles sensitive Data since 7.4.0. "empty" in Puppet-Core handles sensitive Data since Puppet 7.9.0. So the Workarounds for Sensitive Data can be elminiated. fixes 4287df8
1 parent def5d0f commit 3d5f40b

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

manifests/userlist.pp

+1-3
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
epp_section_name => $section_name,
5151
},
5252
)
53-
# we have to unwrap here, as "concat" cannot handle Sensitive Data
54-
$_content = if $content =~ Sensitive { $content.unwrap } else { $content }
5553

5654
if $instance == 'haproxy' {
5755
$instance_name = 'haproxy'
@@ -64,6 +62,6 @@
6462
concat::fragment { "${instance_name}-${section_name}_userlist_block":
6563
order => "12-${section_name}-00",
6664
target => $_config_file,
67-
content => $_content,
65+
content => $content,
6866
}
6967
}

metadata.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"name": "puppetlabs/concat",
17-
"version_requirement": ">= 1.2.3 < 10.0.0"
17+
"version_requirement": ">= 7.4.0 < 10.0.0"
1818
}
1919
],
2020
"operatingsystem_support": [
@@ -76,7 +76,7 @@
7676
"requirements": [
7777
{
7878
"name": "puppet",
79-
"version_requirement": ">= 7.0.0 < 9.0.0"
79+
"version_requirement": ">= 7.9.0 < 9.0.0"
8080
}
8181
],
8282
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",

spec/defines/userlist_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
is_expected.to contain_concat__fragment('haproxy-admins_userlist_block').with(
3737
'order' => '12-admins-00',
3838
'target' => '/etc/haproxy/haproxy.cfg',
39-
'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",
39+
'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
4040
)
4141
}
4242
end

templates/haproxy_userlist_block.epp

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ userlist <%= $epp_section_name %>
1414
}
1515
}
1616
$epp_users.each |Variant[String, Sensitive[String]] $user| {
17-
# TODO: remove this Workaround, as soon as Function empty() can handle
18-
# Sensitive (Pullrequest pending)
19-
$user_unsensitive = if $user =~ Sensitive { $user.unwrap } else { $user }
20-
unless $user_unsensitive.empty {
17+
unless $user.empty {
2118
-%>
22-
user <%= $user_unsensitive %>
19+
user <%= $user %>
2320
<%-
2421
}
2522
}

0 commit comments

Comments
 (0)