On Friday, November 7, 2014 11:39:53 AM UTC-6, Felix.Frank wrote:
>
> On 11/07/2014 03:40 PM, jcbollinger wrote: 
> > If you need to support multiple some::fun_instances, with some but not 
> > all sharing any given $sname (i.e. a many to many relationship), then 
> > you're going to need to make deeper changes. 
>
> Yeah. 
>
> FWIW, this is the one use case that worries me most when thinking about 
> patterns to eliminate the defined() horror. 
>
> define something::specific($group) { 
>     file { "/things/$group/$name": } 
>     if !defined( File["/things/$group"] ) { 
>         file { "/things/$group": ensure => directory } 
>     } 
> } 
>
> I.e., a defined type of which some but not all instances depend on a 
> shared resource. Constraints could ensure a consistent catalog, but how 
> can the dependency be automatically satisfied without defined() or 
> ensure_resource()? 
>
>

Well, my original idea for Constraints called for them to handle this issue 
by synthesizing a resource in the event that there were constraints 
declared on a resource that was not itself declared.  They were also to set 
resource parameter values under certain circumstances.  Those are rather 
trickier propositions than validating declared resources, though, and I 
doubt they could be achieved without support from the Puppet core.  Relying 
on such a facility would be better than using defined() or 
ensure_resource(), though, because the declared constraints collectively 
describe the requirements on the resource so that you don't have to guess 
about them.

As an alternative, we had a discussion in the dev group a couple of months 
back where I advanced the proposition that the distinction between resource 
declarations and (old style) resource overrides be removed.  This is 
similar, but not identical, to the longstanding proposition to have Puppet 
merge identical resource declarations.  As I understand it, though, a 
different direction was chosen.


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/675c63f8-6008-4a81-a4e9-3e88f6e6df40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to