From bcb050bd6cba3bf103c64a1f20e6f650425e4f9e Mon Sep 17 00:00:00 2001 From: Steve Russell Date: Thu, 1 Aug 2024 00:02:09 -0700 Subject: [PATCH] No quote wrapping for non-sysctl sections Although quoting space-containing values in the `[sysctl]` section of a tuned profile is fine, arguably necessary, and shown in RedHat's included default tuning profiles, when our template adds quotes to all values in all sections, they are taken literally and included as if they were part of the value itself. Adjust this quote-by-default logic in the profile template so that it only quotes values inside of the `[sysctl]` section, and nothing else. It is still possible for anyone who needs literal quotes around a value outside of this section to pass them as part of Puppet's value, but the template will no longer add them. --- templates/tuned.conf.epp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/tuned.conf.epp b/templates/tuned.conf.epp index 1973a7d..4557e48 100644 --- a/templates/tuned.conf.epp +++ b/templates/tuned.conf.epp @@ -1,4 +1,7 @@ -<% | Hash[String[1], Hash[String[1],Variant[String[1],Numeric]]] $data | -%> +<% | + Hash[String[1], Hash[String[1],Variant[String[1],Numeric]]] $data, + Array[String[1]] $quoted_sections = ['sysctl'], +| -%> # # tuned configuration managed by Puppet # @@ -6,6 +9,6 @@ [<%= $section %>] <% sort(keys($data[$section])).each |$key| { -%> -<%= $key %>=<% if (' ' in $data[$section][$key]) { -%>"<%= $data[$section][$key] %>"<% } else { -%><%= $data[$section][$key] %><% } %> +<%= $key %>=<% if (' ' in $data[$section][$key]) and ($section in $quoted_sections) { -%>"<%= $data[$section][$key] %>"<% } else { -%><%= $data[$section][$key] %><% } %> <% } -%> <% } -%>