On Friday, October 21, 2016 at 9:48:02 AM UTC-5, re-g...@wiu.edu wrote:
 

> As it seems saz-rsyslog is the best puppet module for managing rsyslog, I 
> decided to take a hint from @jcbollinger on configuration, rather than 
> replacing the module.
>
> I decided to change the values of the parent Rsyslog class parameters so 
> that they are the seen as the "default" for The Foreman (I refer to 
> "default" as eluded to in a previous reply regarding use of Hiera to change 
> these values). But I did not want to implement Hiera just for one class and 
> four parameters. So I added the following changes on all puppet master 
> servers to the production/manifests/site.pp file:
>
> File: /etc/puppet/environments/production/manifests/site.pp
> class { 'rsyslog':
>     preserve_fqdn        => true,
>     gnutls_package_name  => false,
>     relp_package_name    => false,
>     rsyslog_package_name => false
> }
>
> This changes the values of these parameters globally, which is how I had 
> it set in The Foreman any way.
> And in The Foreman, I removed all values set for the parent Rsyslog class 
> parameters, leaving them checked to use the default value. I left the 
> values set in The Foreman for Rsyslog::client subclass parameters unchanged 
> (which is necessary because these values change based on node facts). I did 
> leave the rsyslog parent class assigned to all nodes in The Foreman, though 
> the ENC output does not set any parameters for this class.
>
> This fixed the duplicate declaration issue I was experiencing.
> The reason why I believe this fixed the duplicate declaration error is 
> because I assume Puppet's intended behavior is to always declare in the 
> catalog the classes from the site.pp file before the classes from the ENC.
>
> This is obviously not ideal, but I justify this with the argument that I 
> am simply changing the "default" values of the saz-rsyslog puppet module 
> Rsyslog class - but without having to modify the module's code.
> This is a good enough work-around for me for now.
> -RG
>
>

I'm glad you have found a workaround that solves the problem for you.  I 
suspect that you are basically correct about why it works; that is, that 
Puppet evaluates the top-scope declaration of class ::rsyslog before it 
evaluates any class declarations from the ENC.

To make future trouble in this area less likely, however, I recommend that 
you adjust your mental model.  Unlike my recommended solution based on 
automated data binding, what you have done is *not* analogous to changing 
Foreman's view of the default values for the class's parameters.

   - In the first place, your class declaration in site.pp is indeed a *bona 
   fide* class declaration, applying to every node.  As long as it's there, 
   every node will get class `rsyslog`, with the parameters you've specified, 
   regardless of what you specify via The Foreman.
   - In the second place, you now will *reliably* get duplicate declaration 
   errors if you try to declare any non-default parameters for class rsyslog 
   via Foreman.  That may actually be an improvement over getting such errors 
   unpredictably, however.

Note also that your solution does not resolve the underlying problem of 
your set of declarations being sensitive to evaluation order.  Instead, it 
asserts sufficient control over the evaluation order to avoid the errors 
you experienced.  I find no documentation of the relative evaluation order 
you observe, and if it is undocumented then it is fair game for a change in 
some future version of Puppet.  (And indeed, Puppet has historically been 
pretty open to changing even documented behavior, albeit in a manner 
consistent with its commitment to semantic versioning.


John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/47396af8-65ff-4051-86e0-88e3a363620a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to