[Puppet Users] declare and include classes

2011-11-22 Thread Arnau Bria
Hi all,

after moving to parametrized classes, I've started to declare them
instead of including.

Now, I'm trying to understand the differences (internal) between
declare and include, and, reading
http://docs.puppetlabs.com/guides/parameterized_classes.html again, I
found some sentence which confuses me:

Since include wasn’t designed for use with parameterized classes

I know you can't include a resource, so a class eith parameters must be
 declared. But, If I don't use params, I can include the class...

so, what are the big differnces between declare and include?

TIA,
Arnau

-- 
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.



Re: [Puppet Users] declare and include classes

2011-11-22 Thread Nan Liu
On Tue, Nov 22, 2011 at 11:31 AM, Arnau Bria arnaub...@pic.es wrote:
 Hi all,

 after moving to parametrized classes, I've started to declare them
 instead of including.

 Now, I'm trying to understand the differences (internal) between
 declare and include, and, reading
 http://docs.puppetlabs.com/guides/parameterized_classes.html again, I
 found some sentence which confuses me:

 Since include wasn’t designed for use with parameterized classes

 I know you can't include a resource, so a class eith parameters must be
  declared. But, If I don't use params, I can include the class...

 so, what are the big differnces between declare and include?

You can use include function if:
class is not parameterized.
class is parameterized, but provide default values: (i.e. class sample
($param = 'val1') {...})
class is already declared (you can include class multiple times
throughout your manifests).

include does not support:
stages
relationship (require function provides include+require.)

class declaration supports:
classes that are both parametrized and non-parametrized.
stages
relationship

class declaration does not support:
redeclaration of classes

I think that's all. HTH,

Nan

-- 
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.