On Wednesday, February 19, 2014 5:16:00 AM UTC-6, Daniele Sluijters wrote:
>
> Hi everyone,
>
> As I was browsing through a few modules on the Forge I noticed that more 
> and more people seem to have taken to the `if ! defined(Package['name']) 
> {}` to ensure their module doesn't cause a duplicate resource declaration 
> with another module, third party or your own, that is also managing that 
> package.
>


Oh, dear.  You've brought up one of my pet peeves.

 

>
> From a purist perception this should never happen in the first place as 
> there are suddenly two modules declaring the same resource. Unfortunately 
> this is often what it comes down to when you pull in a few modules from the 
> Forge or Github, especially with things like build-essential that a 
> multitude of different things might need. In turn this makes using 
> third-party modules more difficult because they might introduce issues like 
> these that, especially for newcomers to the platform, are troublesome to 
> fix.
>


You are exactly right on all counts.

 

>
> I was hoping we could devise a solution, at least for package resources, 
> that would allow multiple declarations of the package and have those 
> declarations resolve themselves. I'm specifically focussing on package 
> here because that's the most common source of trouble, things like an 
> rbenv, rvm and pyenv module all declaring that they need 'build-essential'.
>
>

I'm not very fond of the idea of hardwiring special support for Package 
resources into Puppet (nor for resources of any other specific type).  I 
still like my "constraints" idea, to which Felix directed your attention, 
but if something like that is ever implemented then adopting it will 
require (smallish) modifications to be made to a lot of manifests.

 

> My other thought was that perhaps it should be possible to `require => 
> Package['name']` from any resource and if that resource isn't declared in 
> the catalog spawn the resource ourselves but if it is defined that 
> declaration is used. I'm not sure how we could deal with scenario's where 
> someone requires said package but we explicitly define it as absent in our 
> manifests.
>
>

A solution might be possible along such lines, and there's no particular 
reason for it to be specific to the Package resource type.  Puppet could 
conceivably provide an option for native types to support autodeclaration 
of referenced but undeclared instances.  If, after evaluating all relevant 
manifests, it discovered one or more references to a specific resource of 
an auto-declarable type, then it would create a corresponding resource in 
the catalog and initialize it with (say) an auto_init() method of the type.

It is true that such a mechanism would not kick in where a resource is 
explicitly declared absent, but that's a limitation of the (mal)practice of 
using "if ! defined()", too -- a module compatibility issue that 
'constraints' could detect, but that simple declaration checks, in any 
form, cannot.  A more serious limitation is that you may *want* catalog 
compilation to fail when resources are referenced but not anywhere 
declared.  The catalog compiler should certainly emit warnings in these 
cases, but I would be happier if autodeclaration had to be explicitly 
enabled in the master's configuration in order to be used at all.

 

> Please spare me the "they're being wrong on the internet" speech, I'm well 
> aware of it but the truth of the matter is you'll never be able to 
> coordinate the community in such a way that this issue doesn't pop up. I'm 
> not really concerned about experienced Puppet users/developers that can 
> solve this for themselves, more about the less developer oriented operator 
> that has to use Puppet for whatever reason. Another approach would be to 
> really curate the modules up on the Forge but I doubt anyone feels like 
> doing that or has the time for it.
>
>

I spare you the speech.  No one here needs it, anyway.

 

> I'm not sure if it's even desirable or possible to solve this issue in the 
> first place but I was curious if anyone has given any more thought to this?
>
>

Yes, indeed, as Felix said.  This is the Big Kahuna of module compatibility 
problems, and such issues have been on the community's mind at least since 
the Forge was introduced.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/7529357d-be0c-47eb-ac17-26d9fed0d386%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to