Puppetlabs apache module: setting the value for @expires_default in apache::mod::expires

109 views
Skip to first unread message

Flannon Jackson

unread,
Jan 18, 2017, 12:15:47 PM1/18/17
to Puppet Users
I'm running puppet 4.8 and I'm trying to configure the Puppetlabs-Apache module, which is v1.10.0.  According to the README apache::mod::expires has three parameters, one of which is expires_default.  (https://forge.puppet.com/puppetlabs/apache#class-apachemodexpires).  It also says that is uses expires.conf.erb to generate it's configuration and that expires_default is undef by default, and puppetlabs-apache/templates/mod/expires.conf.erb has the following template,

    ExpiresActive <%= scope.function_bool2httpd([@expires_active]) %>
    <%- if ! @expires_default.nil? and ! @expires_default.empty? -%>
    ExpiresDefault "<%= @expires_default %>"
    <%- end -%>
    <%- if ! @expires_by_type.nil? and ! @expires_by_type.empty? -%>
    <%- [@expires_by_type].flatten.each do |line| -%>
    <%- line.map do |type, seconds| -%>
    ExpiresByType <%= type %> "<%= seconds -%>"
    <%- end -%>
    <%- end -%>
    <%- end -%>

So I figured I could do this to set the value for ExpiresDefault in the apache config,

    class { 'apache::mod::expires' :
        expires_default => ['access', 'plus', '5184000', 'seconds',],
    }

But when I run Puppet I get a duplicate declarations error,

"Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Apache::Mod[expires] is already declared in file /tmp/vagrant-puppet/environments/development/modules/thirdparty/apache/manifests/default_mods.pp:66; cannot redeclare at /tmp/vagrant-puppet/environments/development/modules/thirdparty/apache/manifests/mod/expires.pp:7 at /tmp/vagrant-puppet/environments/development/modules/thirdparty/apache/manifests/mod/expires.pp:7:3 on node loris.local"

So it looks like apache::mod::expires is defined in default_mods.pp and mod/expires.pp.  I'm not really sure what's going on, but I feel like I'm missing something very basic here.

Any help would be appreciated,

Thanks,

-f


Rob Nelson

unread,
Jan 18, 2017, 5:15:03 PM1/18/17
to puppet...@googlegroups.com
In the `apache` class there is a `default_mods` parameter as well (param https://github.com/puppetlabs/puppetlabs-apache#default_mods and code path https://github.com/puppetlabs/puppetlabs-apache/blob/28e9d41b2028f13c81b43e47c79bd28899170ccb/manifests/init.pp#L334-L345), it looks like you would want to set that to `false` or an array that does not contain `expires`. That is just from a simple reading of the description and the code, not from experience using it, though.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4a571f98-16dd-4e7c-af1d-da4e5ba89871%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Flannon Jackson

unread,
Jan 18, 2017, 5:42:31 PM1/18/17
to Puppet Users
That was it.  Thanks very much for the reply.

-f
Reply all
Reply to author
Forward
0 new messages