ripienaar/puppet-classifier

Duplicate declaration: Class[Classifier] is already declared

ggeldenhuis opened this issue · 7 comments

When using the classifier script classifier_enc.rb to provide environment classification I get the following error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Duplicate declaration: Class[Classifier] is already declared; cannot redeclare on node myserver.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The master section on the puppet server contains:

  external_nodes = /usr/local/bin/classifier_enc.rb --data-dir /etc/puppetlabs/code/hieradata --node-pattern %%.yaml

I am using puppet opensource 5.3.3

So one potential fix is to just remove the class declaration completely from the classification hash. It thus strike me as a bit final and that I am potentially missing something.

if you're using the ENC you dont also include it in code yes

so perhaps a flag to enable/disable it would be handy? I can add that. I was also thinking of adding slightly more enhance ability to specify environment location.

you mean you want the ENC not to include the classifier class via a flag? why is including it in the ENC a problem?

yes, because if I don't modify the classifier_enc.rb script to exclude the class from the final result it sends to puppet I get an error saying duplicate declaration: Class[Classifier]

then dont include the class in your puppet code. why do you use it in your puppet code?

The only variables the ENC sets are ENC related ones, the remaining user accessible properties remain unset and you supply those via hiera - no need to do anything with the classifier class in your code if you use the ENC?

Problem was caused by including classifier as part of the node default declaration which was needed before using the enc script for environment classification too.