On Monday, October 17, 2016 at 3:15:51 PM UTC-5, re-g...@wiu.edu wrote:
>
>
>
> On Friday, October 14, 2016 at 5:08:31 PM UTC-5, re-g...@wiu.edu wrote:
>>
>>
>>
>> On Thursday, October 13, 2016 at 9:15:58 AM UTC-5, Rob Nelson wrote:
>>>
>>> I've worked with saz in the past and believe he would be very receptive 
>>> to PRs that address this issue, as well, if RG or anyone else wanted to 
>>> contribute them. That would be one of the better solutions to the problem.
>>>
>>> Rob Nelson
>>> rnel...@gmail.com
>>>
>>>
>>> I think I've given you a pretty good handle on the nature of the 
>>>> problem, and I'm inclined to think that a solution that addresses the 
>>>> problem at its root will take care of the whole suite of issues.
>>>>
>>>
>> Lots and lots of thanks to jcbollinger.
>> Here is what I have done as a result of this thread:
>>
>> Submitted an issue with saz-rsyslog:
>> Duplicate Declaration Class[Rsyslog] with The Foreman as ENC during 
>> catalog compilation #237
>> https://github.com/saz/puppet-rsyslog/issues/237
>>
>> Posted a follow-up question to a related thread on The Foreman mail list 
>> to determine if The Foreman also may be exhibiting a bug, or if the issue 
>> may be my configuration:
>> Duplicate declaration error.
>> https://groups.google.com/d/topic/foreman-users/k0JgABtszdU/discussion   
>> (my post is waiting for approval as of 22:00 GMT 10/14/2016)
>>
>> My current thought at this time is two points:
>> 1. saz-rsyslog is written in such a way that declaring a subclass before 
>> the parent class causes duplicate declaration errors - but I am told the 
>> module inheritance should be addressed, and would resolve this issue.
>> 2. The Foreman, under undetermined circumstances (maybe my 
>> misconfiguration), will randomly declare parent classes and subclass out of 
>> order - but I am told this is not an issue with puppet modules that use 
>> inheritance correctly - thus there might be an underlying bug with The 
>> Foreman because this error will not appear under modules' expected 
>> inheritance.
>>
>>
> This is what was posted on The Foreman mail list group:
> https://groups.google.com/d/topic/foreman-users/k0JgABtszdU/discussion
>
>> This is an issue with the format of the ENC YAML used between Foreman 
>> and Puppet, and is best fixed in the module. 
>> The list of classes is given as a hash/dictionary and so has no 
>> particular order defined - it's down to the Puppet master/server to 
>> iterate over it, and it probably does so in no particular order. It 
>> isn't under Foreman's control.
>
>
> I now believe this is truly the root of my problem. 
>
> The evidence is looking at the ENC output and the Puppet-generated Catalog 
> file on each of the master puppet servers.
> As you can see below, the puppet-generated catalog on the secondary-master 
> puppet server has put rsyslog::client before rsyslog - this causes the 
> failure.
> However, The Foreman ENC output is the same on both primary and secondary 
> master puppet servers.
>
>

You have taken a step backward there.  I remind you that duplicate 
declaration errors occur *during catalog building*, and that catalog 
building fails if one occurs.  It is therefore impossible to compare a 
catalog from the failure case to a catalog from the success case, because 
no catalog is ever created in the failure case.

It is useful to confirm that Foreman's ENC produces consistent output -- if 
indeed it does.  I'm not surprised that you obtained identical ENC output 
from two different Foreman servers, but it's unclear to me whether you have 
compared the failure-case ENC output with the success-case ENC output.  I 
am inclined to guess that these do differ, because clearly *something* 
changes.

Unless ....

Do check the the 'ordering' parameter in the [master] section of your 
master's puppet configuration.  If it is specified, and the specified value 
is anything other than 'manifest', then it is possible that setting its 
value to 'manifest' (the default) will help.  I emphasize, however, that 
this is a workaround for sloppy manifest code, not a bona fide solution.

You've made a lot of hay about saz-rsyslog being approved / known-good / 
high-quality, with no particular justification.  Certainly the module being 
available from the Forge should not be interpreted to support such a 
conclusion.  To be clear: having looked at the code of the module in 
question, I think it is generally of good quality.  As I have already said, 
however, and as Dominic Cleal told you over on the Foreman group, the 
fundamental problem here is in the manifests -- *the module's* manifests.  
The module is designed and its manifests are written in a manner that is 
especially conducive to the kind of problem you've encountered.

 

> Is this correct, that the yaml file in /var/lib/puppet/yaml/node/ is 
> exclusively generated by Puppet based on the ENC yaml?
> If this is correct, then this is the root of the problem.
>


I'm not sure what significance you're attributing to those particular 
files, but it's probably the wrong significance.  Yes, to the best of my 
knowledge and understanding, Puppet generates those files based on the 
node's certificate and facts, and the associated ENC output (if any).  But 
no, there is no reason to think that the root of your problem lies here.

I have already explained the root of the problem several times, but I'll 
try just once more: the saz-rsyslog module is designed and implemented in a 
way that does not support declaring class ::rsyslog via a resource-like 
declaration (whether Puppet DSL's version of that or its ENC analog) while 
also declaring any of several other public classes from the same module.  
If there is any flaw to be attributed to Puppet here, it is that catalog 
building sometimes works for you anyway, not that it sometimes fails in the 
face this kind of misuse.

 

>
> The next question is, why does Puppet assemble a catalog with classes out 
> of order, when the ENC output has them in the correct order?
>


The order in which classes are listed in the ENC output is not significant, 
nor indeed is the order of entries in any YAML hash logically significant.  
That's basically the answer.

Depending on several underlying factors, it might be that under some 
circumstances you do reliably see classes specified by the ENC being 
evaluated in an order consistent with the lexical order of the ENC output.  
As I remarked in my previous message, the version of Ruby on which your 
master is running is one of my first guesses as to a source differences in 
that respect.

 

> I have seen two answers to this question of classes getting out of order 
> in the puppet catalog:
>


Classes are not getting out of order in the puppet catalog, nor indeed are 
the files that you earlier asked about (serialized) Puppet catalogs.

 

>  1. one class 'cA' depends on 'cB', so puppet puts 'cB' first in the 
> catalog. - but this is not the reason in my case.
>  2. "... If you do not see the error on every run then it is modulated by 
> something that varies between runs. That could be almost anything: 
> manifests, data, results of function calls, node facts, or ENC output. ..." 
> - which should be unlikely since it works on one secondary master and not 
> the next secondary master, both configured exactly the same.
>
>
You're now diverting to a different topic: why the observed behavior 
changes *over time*, as opposed to why it differs between masters.  I have 
no reason to doubt your assertion that the manifests involved are the same 
everywhere.  The data I refer to would be Puppet external data, which it 
seems you are not using, so that is trivially the same from run to run.  
But that still leaves many things that could vary over time; the list you 
quoted covers other likely candidates, but it was never intended to be 
exhaustive.  If I had to guess, though, I'd place my bet on the ENC output 
varying.  Do note that it doesn't have to be the part of the ENC output 
that designates classes rsyslog and rsyslog::client that changes; a variety 
of other changes might result in an inversion of the order in which those 
two are evaluated, too.

 

> Is there a configuration issue causing this issue? Where would I begin 
> looking for something that may be causing this puppet-catalog problem?
>


There is an unsupported-use-of-module issue ultimately causing all your 
problems, as I have been saying since the beginning.  It would be best to 
solve *that* problem, either by choosing a different module or by 
restricting yourself to supported uses of the module you have chosen (e.g. 
by using automated data binding to assign values to class parameters).

If you insist on continuing in your misuse and trying to work around the 
problems that follow from that, then it seems reasonable to focus on 
differences between the secondary master that fails and those that always 
work in this regard, if in fact they really do.  Compare software versions 
(especially of Puppet and of the Ruby on which Puppet is running (and watch 
out for multiple Ruby versions being co-installed).  Compare (puppet) 
config files.  Heck, replace the troublesome secondary master with a clone 
of one of the others if you can't figure out what differs.

 

> Running `puppet agent -t` on the client against the primary master puppet 
> server is successful
> Running `puppet agent -t` on the client against the secondary master 
> puppet server fails with duplicate declaration
>
>  

I note in passing that you've now shifted back to the topic of behavior 
differing between different masters.



> On the primary master puppet server
>
> --The Foreman ENC output--
>
> primary-puppet:/var/lib/puppet/yaml/foreman/server1.mydomain.example.com.yaml
> ...snip...
>     rsyslog: 
>       gnutls_package_name: false
>       preserve_fqdn: true
>       relp_package_name: false
>       rsyslog_package_name: false
>     "rsyslog::client": 
>       log_local: true
>       remote_type: udp
>       server: rsyslog.mydomain.example.com
> ...snip...
> --end--
>
> --Puppet generated catalog--
> primary-puppet:/var/lib/puppet/yaml/node/server1.mydomain.example.com.yaml
>     rsyslog: 
>       gnutls_package_name: false
>       preserve_fqdn: true
>       relp_package_name: false
>       rsyslog_package_name: false
>     "rsyslog::client": 
>       log_local: true
>       remote_type: udp
>       server: rsyslog.mydomain.example.com
> --end--
>
>
> On the secondary master puppet server
>
> --The Foreman ENC output--
>
> secondary-puppet:/var/lib/puppet/yaml/foreman/server1.mydomain.example.com.yaml
> ...snip...
>   rsyslog:
>     gnutls_package_name: false
>     preserve_fqdn: true
>     relp_package_name: false
>     rsyslog_package_name: false
>   rsyslog::client:
>     log_local: true
>     remote_type: udp
>     server: rsyslog.mydomain.example.com
> ...snip...
> --end--
>
> --Puppet generated catalog--
>
> secondary-puppet:/var/lib/puppet/yaml/node/server1.mydomain.example.com.yaml
> ...snip...
>     "rsyslog::client": 
>       remote_type: udp
>       log_local: true
>       server: rsyslog.mydomain.example.com
>     ntp: 
>       server_list: 
>         - "ntpserver.mydomain.example.com"
>     rsyslog: 
>       gnutls_package_name: false
>       rsyslog_package_name: false
>       preserve_fqdn: true
>       relp_package_name: false
> ...snip...
> --end--
>


   1. Those are not catalogs you are looking at.
   2. You've presented excerpts of the ENC output and node dumps as if 
   those are the only parts that matter.  The totality of the ENC output 
   matters (but I don't think the node dumps actually matter at all).


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/1a9e9188-208f-4a02-bd2f-5c6461c944ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to