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 <henrik.lindb...@puppet.com>
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 salty.cowd...@gmail.com <mailto:
> salty.cowd...@gmail.com>
> >
> > 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 puppet-users+unsubscr...@googlegroups.com
> > <mailto:puppet-users+unsubscr...@googlegroups.com>.
> > 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 puppet-users+unsubscr...@googlegroups.com.
> 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                       salty.cowd...@gmail.com

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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAArvnv3dQ-t2W_0%2BNpq0qD9%2BkHAnsLXfwJtJQHxJURywdb7wZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to