On Saturday, September 28, 2019 at 5:27:24 AM UTC-5, Martin Alfke wrote:
>
> Hi Timo, 
>
> there are two ways to achieve duplicate resource prevention: 
>
> 1. virtual resources 
>
> [...]
>
>  

> 2nd option is to use the ensure_packages or ensure_resources function (I 
> don't like this way as it hides what you want to achieve): 
>
>
 
I also dislike ensure_packages and ensure_resources, to the extent that I 
consider their usage an anti-pattern.  I have written here on that topic 
several times.  Use of virtual resources is better, but IMO *best* is (3) 
create a single class whose responsibility is or includes to manage the 
package in question, and to have other classes that require the package 
ensure it present by declaring the class responsible for that (with an 
include-like declaration, not a resource-like one).  This is one of the 
core use cases for the idempotency of classes.


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/bcea59bb-fd5b-4612-b3ae-66eb7b346996%40googlegroups.com.

Reply via email to