Hi Dan,

sorry if I come around bluntly about this, but:

On 01/20/2012 10:00 AM, Dan Bode wrote:
> * static resources in a defined resource type (avoids having to use
> classes to store all static dependencies)
> 
> * the big reason I keep on leaning on it is for package dependencies.
> Often something needs an additional package installed (and it is
> possible that other modules may have that same package dependency, and I
> don't want to have to create a new class every time that I need another
> package (especially for something complicated that may have tons of
> package dependencies)

I disagree. The coding overhead for a simple wrapper class is not much
larger than adding if defined(); of course, there is the matter of
organizing those wrappers in your modules, though.
Still, endorsing defined() abuse in such a manner will lead to bad (and
ugly) code all over the place (how do you protect against redeclaration
outside your own defined type?)

> puppet-apt has a relevant pull request where someone wants to wrap a
> defined? around python-software-properties for this exact reason
> 
> https://github.com/puppetlabs/puppet-apt/pull/10

Again, I find the endorsement of clumsy design questionable. Common
dependencies should be isolated and exported into a mutual dependency
(module).

If there are real life difficulties that make such workflows impossible
at the moment, I still think that it's a bad idea to root flaw-prone
workarounds ever deeper into the module pool.

> How about deprecating defined?(Type['title']), but allowing it to accept
> a resource hash? This would definitely satisfy my use cases while
> alleviating concerns about resource attribute conflicts/parse order
> dependencies
>
> if defined?(
>  {
>     package['foo'] => { ensure => present }
>   }
> ) {
>   package { 'foo': ensure => present }
> }

Interesting. This will add some complexity to the DSL, which I'd be wary
of, but if there are truly compelling use cases, this might be
worthwile? I'm not sure. Does this not suffer from the same problems the
current defined() has?

Sincerely,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to