On Tue, 5 Jun 2018, at 15:01, jcbollinger wrote:
>
>
> On Monday, June 4, 2018 at 1:06:52 PM UTC-5, Ramin K wrote:
> >
> > On 6/4/18 8:25 AM, Peter Berghold wrote:
> > > I was looking at someone else's code one day last week and saw a pattern
> > > I've not seen before. Maybe that's what I get for developing Puppet code
> > > in a vacuum. :-)
> > >
> > > class someclass (
> > > $parm1 = $::someclass::params::parm1,
> > > $parm2 = $::someclass::params::parm2 # so far I get it.
> > > ) inherits someclass::params { # ok, I get it
> > >
> > > class{'someclass::package': } # OK
> > > -> class('someclass::configure':} # right...
> > > -> Class{'someclass':} # HUH? What does that
> > do?
> > > }
> > >
> > > Is that last step necessary and why?
> >
> >
> > The last step was fairly common in Puppet 2.7 code before Anchors.
>
>
>
> Are you sure about that, Ramin? I've been around Puppet since well before
> v2.7, and to the best of my knowledge, Class{'someclass':} (with capital
> 'C') is and always has been syntactically invalid. I'm prepared to learn
> something new today, but you'll need to point me to some docs to support
> your assertion.
>
> Myself, I'm inclined to guess that it's a simple typo, that an ordinary
> resource-style class declaration (with lowercase 'c') is what was intended.
>
class{'someclass::package': }
-> class('someclass::configure':}
-> Class["someclass"] # or -> Class[$name]
Is the correct version of this. It's a "soft" version of the anchor pattern,
because:
package{"foo": require => Class["someclass"]}
will have the inner classes completed before it without any crazy extra
resources and stuff and it handles the case most people actually care for - but
this is not a full contained class like contain() makes, you should probably
use contain() today.
--
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/1528204221.2225351.1397064328.7404B769%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.