Since I wrote the example in question, I'm comfortable saying it's dumb.
The reason it was useful to have, theoretically, is that 'require'
used to be clobbered - that is, if the contained resource specified
one, then the defined resource's require wouldn't count. We fixed
that about 18 mos ago, though.
And really, in almost all cases it's completely transparent, so this
should really just be a footnote that should largely be ignored, like
it is currently.
On May 9, 2010, at 11:21 AM, Nigel Kersten wrote:
Had a little discussion on puppet-users about this. Is there some
historical reason why this example in the docs is structured the way
it is? Weren't metaparameters always supported on defined types?
---------- Forwarded message ----------
From: Nigel Kersten <[email protected]>
Date: Fri, May 7, 2010 at 8:43 PM
Subject: Puppet docs, defined types and requires.
To: [email protected]
I don't know if it's just me, but I find this example horribly
confusing, and I'm wondering if it's just really out of date.
http://docs.puppetlabs.com/guides/language_tutorial.html#definitions
define svn_repo($path) { exec {"create_repo_${name}":
command => "/usr/bin/svnadmin create $path/$title", unless =>
"/bin/test -d $path", } if $require { Exec["create_repo_
${name}"]{ require +> $require, } } } svn_repo
{ puppet: path => "/var/svn", require => Package[subversion], }
It doesn't really make any sense to me.
What's the problem with the require being set on Svn_repo[puppet]
rather than Svn_repo[puppet]/Exec[create_repo_puppet] ?
Another problem is that this model breaks down entirely if you need
to set a require on Exec[create_repo_puppet] itself as Puppet will
complain that the require has already been defined. (which seems
kind of odd given the use of plusignment, but I don't use this
syntax ever, so maybe it's just me.)
It just feels like you could accomplish the same thing with:
define svn_repo($path) { exec {"create_repo_${name}":
command => "/usr/bin/svnadmin create $path/$title", unless =>
"/bin/test -d $path", } } svn_repo { puppet: path => "/var/
svn", require => Package[subversion], }
with the added bonus that you can set additional requires inside the
defined type without having to jump through any hoops.
Were metaparameters not supported with defined types in the past?
--
nigel
--
nigel
--
You received this message because you are subscribed to the Google
Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
.
--
The surest sign that intelligent life exists elsewhere in the universe
is that it has never tried to contact us.
--Calvin and Hobbes (Bill Watterson)
---------------------------------------------------------------------
Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199
--
You received this message because you are subscribed to the Google Groups "Puppet
Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.