On Wednesday, May 30, 2018 at 11:01:40 AM UTC-5, Ugo Bellavance wrote:
>
>
>>
>> Of course, where a resource type or class defines default values for its
>> parameters and those values meet your requirements, it's fine to rely on
>> those. You don't necessarily need to explicitly provide a value for every
>> parameter. And do note the important distinction between *declaring* a
>> class or resource, and *defining* a class or resource type.
>>
>
> This is something that I have always had trouble understanding and lacked
> time to read more on it. And even if I read on it...
>
The distinction is analogous to that between defining a function and
calling one. "Defining" says what the class or type name means:
# Class definition
class mymodule::myclass (String $a_param) {
notify { "${a_param}": }
}
or
# (Defined) type definition
define mymodule::mytype (String $a_param) {
notify { "${title}: ${a_param}": }
}
"Declaring" says to actually use the entity:
# A resource-like class declaration
class { 'mymodule::myclass': a_param => 'value' }
# Various include-like class declarations:
include 'mymodule::myclass'
require 'mymodule::myclass'
contain 'mymodule::myclass'
# A resource declaration
mymodule::mytype { 'title': a_param => 'value' }
# A function call that causes a resource to be declared
create_resources('mymodule::mytype', { 'title2' => { 'a_param' => 'value2' }
})
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users/6d6efd06-2bf6-4b70-bcb1-1debcb32e61f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.