On 01/10/2011 11:01 PM, Peter Meier wrote:
> 
> Yep, I also recently started thinking about various new introduced
> problems I see with parametrized classes. For example, how could I do
> the following in the future with parametrized classes:
> 
> class apache {}
> define apache::vhost(){
>   include ::apache
>   ...
> }

<snip>

I feel the same way. To give another example: I have some things I need
to do *after* puppet finishes it's run, e.g.

class apply_and_test_new_puppet_conf {
  include at_daemon
  ...
}

class trigger_puppet_dryrun_in_test_environment {
  include at_daemon
  ...
}

Both use the at daemon to schedule the post-puppet tasks. Some of my
nodes support either feature, and many use both.
So I *must* be able to include my at_daemon class from both classes and
it must work if either or both classes are included by a node. Period.
>From my understanding, that is what classes were conceived for and
taking this away would make the DSL a subset of what it currently is (imo).

Here's an idea, though. How about a keyword much like the current
require function, but with different semantics [burrowing from Peter's
example again]:

define apache::vhost() {
  expect ::apache
}

The semantics could be:
1. If the class is defined in this node's catalogue, treat any use of
apache::vhost as though "require => Class[::apache]" had been specified
2. Otherwise, report an error

This way, relationships could be expressed without limiting ourselves to
unparameterised classes.

This doesn't address the issue of multiple inclusion with different
parameters, but I don't think that one *can* be addressed easily
(actually, I believe it's impossible to allow for that save by
inheritance from the including class, but that's a different discussion).

Cheers,
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-us...@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