Most likely because that’s an easy way to show the parameters a class
supports. Some modules use hiera data to show that, though it is a bit more
complicated to explain and understand, especially for novices.

On Tue, May 21, 2019 at 9:42 AM Peter Berghold <[email protected]>
wrote:

> Using include instead of class makes sense to me and was my instinctive
> thought.
>
> Why on earth, then, do all the (or most) of the Puppet Forge modules use
> the
>
> class{'myclass':
>     param1 => 'thing'
> }
>
> patterns in their examples.  I had begun to believe that was the preferred
> pattern.
>
> I will mend my ways.
>
> On Mon, May 20, 2019 at 3:33 PM Henrik Lindberg <
> [email protected]> wrote:
>
>> On 2019-05-20 18:57, Peter Berghold wrote:
>> > So here I am I have a base profile for my Ubuntu (Debian family)
>> > machines that invokes the class
>> >
>> > class{'apt':
>> >      ... some paramters
>> > }
>> >
>> > I then invoke the class
>> >
>> > class{'postgresql': }
>> >
>> > and now Puppet is screaming that the class 'apt' cannot be invoked
>> > twice.   This seems to be a flaw in Puppet manifests to me.  How to fix?
>> >
>> >
>>
>> The best practice is to not use the resource like `class { name: ... }`
>> syntax to declare a class and instead use `include name` and letting all
>> parameter values come from hiera via automatic parameter lookup.
>>
>> That way, you can include the class as many times as you like - as the
>> parameters are the same every time. Unfortunately, the compiler cannot
>> do the same when classes are declared with parameters even if all places
>> this is done use the exact same values.
>>
>> While it is possible to have a single `class { name: ... }` declaration
>> with subsequent `include name` declarations, the opposite does not work.
>>
>> Hope this helps.
>> - henrik
>>
>> > --
>> >
>> > Peter L. Berghold [email protected] <mailto:
>> [email protected]>
>> >
>> > http://devops.berghold.net
>> >
>> >
>> > --
>> > 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]
>> > <mailto:[email protected]>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/puppet-users/CAArvnv2Ya1Vo1R%3D%2B3YW%3DMp%2BubL%2BZR_WFG1J4o_7OKe33tfm4vw%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/puppet-users/CAArvnv2Ya1Vo1R%3D%2B3YW%3DMp%2BubL%2BZR_WFG1J4o_7OKe33tfm4vw%40mail.gmail.com?utm_medium=email&utm_source=footer
>> >.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>>
>> Visit my Blog "Puppet on the Edge"
>> http://puppet-on-the-edge.blogspot.se/
>>
>> --
>> 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/qbuve5%246tlm%241%40blaine.gmane.org
>> .
>> For more options, visit https://groups.google.com/d/optout.
>
>
>>
>
> --
>
> Peter L. Berghold                       [email protected]
>
> http://devops.berghold.net
>
>
> --
> 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/CAArvnv3dQ-t2W_0%2BNpq0qD9%2BkHAnsLXfwJtJQHxJURywdb7wZA%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAArvnv3dQ-t2W_0%2BNpq0qD9%2BkHAnsLXfwJtJQHxJURywdb7wZA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Rob Nelson

-- 
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/CAC76iT9NzEmv8cgMfo-_J3gf-HB-6odjnT1GxOyPyL85aVCVRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to