Skip to content

Template headers repeated #73

@dsnt02518

Description

@dsnt02518

I'm seeing the _header.erb contents included twice in /etc/freshclam.conf and /etc/sysconfig/freshclam.
I think the problem stems from using ERB.new(...).result(binding) to render the included template directly, instead of scope.function_template(...).

The problem only seems to occur when applying via puppet agent, for some reason using puppet apply on the same catalog doesn't include the header twice.

I've locally found that the replacing the call as in the diff below gets identical and correct behaviour with both puppet apply and puppet agent:

diff --git a/modules/clamav/templates/clamav.conf.erb b/modules/clamav/templates/clamav.conf.erb
index cdd5ce6..b8d2ead 100644
--- a/modules/clamav/templates/clamav.conf.erb
+++ b/modules/clamav/templates/clamav.conf.erb
@@ -1,4 +1,4 @@
-<%= ERB.new(File.read(File.expand_path("_header.erb",File.dirname(file)))).result(binding) -%>
+<%= scope.function_template([File.expand_path("_header.erb",File.dirname(file))]) -%>
 
 <% @config_options.sort.each do |k,v| -%>
 <% Array(v).each do |av| -%>
diff --git a/modules/clamav/templates/sysconfig/freshclam.erb b/modules/clamav/templates/sysconfig/freshclam.erb
index 967280b..8fdfab1 100644
--- a/modules/clamav/templates/sysconfig/freshclam.erb
+++ b/modules/clamav/templates/sysconfig/freshclam.erb
@@ -1,3 +1,3 @@
-<%= ERB.new(File.read(File.expand_path("_header.erb",File.dirname(File.dirname(file))))).result(binding) -%>
+<%= scope.function_template([File.expand_path("_header.erb",File.dirname(File.dirname(file)))]) -%>
 
 FRESHCLAM_DELAY=<%= @freshclam_delay %>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions