Skip to content

Commit

Permalink
Remove stdlib's legacy function usage
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex authored and evgeni committed May 31, 2023
1 parent eafe2c8 commit 58cb84e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions manifests/config/global.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class rsyslog::config::global {
#create a hash just with legacy type values
$legacytype = $rsyslog::config::global_config.filter |$key, $value| { has_key( $value, 'type') }
$legacytype = $rsyslog::config::global_config.filter |$key, $value| { 'type' in $value }

$legacytype.each |$param, $config| {
rsyslog::component::global_config { $param:
Expand All @@ -13,7 +13,7 @@
}

#create a hash just with the non legacy type value
$newtype = $rsyslog::config::global_config.filter |$key, $value| { ! has_key( $value, 'type') }
$newtype = $rsyslog::config::global_config.filter |$key, $value| { ! 'type' in $value }

#flatten the nested hash of hashes to one single hash
$flattendata = $newtype.keys.reduce({}) |$memo, $key| { $memo + { $key => $newtype[$key]["value"] } }
Expand Down
2 changes: 1 addition & 1 deletion templates/action.epp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ action(type="<%= $type %>"
<%}-%>
<% if $config { -%>
<% $config.each |$k, $v| { -%>
<%- if is_array($v) { -%>
<%- if $v =~ Array { -%>
<%= $k %>=<%= join(["[\"", join($v, '", "'), "\"]"], "") %>
<%- } else { -%>
<%= $k %>="<%= $v %>"
Expand Down

0 comments on commit 58cb84e

Please sign in to comment.