On Monday, January 28, 2019 at 5:02:42 PM UTC-6, Jochen Haeberle wrote:
>
> Hi, 
>
> I am using serverless puppet apply on some nodes. I prepared a set of 
> manifests using forge plugins. I developed everything using Vagrant quite 
> fine. 
>
> Now I put my code via git on a debian 9.7 VM with puppet 6.2 and am 
> getting the following errors: 
>
> Error: Evaluation Error: Error while evaluating a Function Call, Duplicate 
> declaration: Package[libapache2-mod-php7.3] is already declared at (file: 
> /etc/puppetlabs/code/environments/production/modules/profile/manifests/software/apache.pp,
>  
> line: 78); cannot redeclare (file: 
> /etc/puppetlabs/code/environments/production/modules/profile/manifests/software/wordpress.pp,
>  
> line: 24) (file: 
> /etc/puppetlabs/code/environments/production/modules/profile/manifests/software/wordpress.pp,
>  
> line: 24, column: 3) 
>
> Both instances use the stdlib function ensure_packages. If I remove one of 
> the instances, I will get the error with another package. 
>
> puppetlabs/stdlib and all other modules are up to date, thanks to r10k, 
> Code is working on a fresh vagrant machine. 
>
> What can be the culprit of this? I have no idea where to look for this 
> problem. 
>
> Thanks in advance vor any hints, regards 
>
>

Broadly speaking, the two possibilities are that

   - stdlib's ensure_packages() does not work correctly on Puppet 6.2
   
OR

   - you're using it wrongly
   
I don't see how we can discriminate between these without some code.  I 
suggest preparing a minimal test case that demonstrates the problem.  If 
the process of producing such a case does not lead you to discovering an 
error yourself, then we here should certainly be able to tell you whether 
the test case is expected to work.  If not, we'll be able to tell you how 
to fix it.  If so, then you will have something to submit in your bug 
report.

As long as I'm standing on this soapbox, though, I'd like to remark that 
ensure_packages() is a jerry-rig, not an actual solution to any Puppet 
problem.  It and its brethren, ensure_package(), ensure_resources(), and 
ensure_resource() should be avoided.  The correct solution in every case 
where one of these is used involves factoring out management of resources 
into a separate class.  That's not always straightforward, else these 
functions would not have been created, but you certainly should not design 
modules with the *expectation* of relying on them.


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/1176d34c-d9b1-4b65-bf86-553c2036450e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to