Still use inherits for params?

57 views
Skip to first unread message

Dan Gibbons

unread,
Apr 13, 2015, 6:34:15 AM4/13/15
to puppet...@googlegroups.com
Hi,

I'm looking at some of our puppet code and trying to keep it clean whilst looking at the puppet 4 deprecation list.

One question I have is regarding inherits;  the docs say that node inheritance is going which we don't use anyway but we do use the params pattern a lot with inherit.

I'm wondering if I should still use inherit for the params or move away to use include instead?
I presume the inherit keyword its self is not being deprecated?

Thanks

Dan

Philipp Dallig

unread,
Apr 13, 2015, 7:26:11 AM4/13/15
to puppet...@googlegroups.com
Hi Dan,

you can still use the keyword inherits for params.pp. It's the recommended way.

Philipp

jcbollinger

unread,
Apr 13, 2015, 8:59:52 AM4/13/15
to puppet...@googlegroups.com
You cannot implement the standard params class pattern on top of 'include'.  The 'include'-family functions (or any other functions) are not evaluated soon enough to ensure that class variables of the included class are available for use as class parameter defaults for the class wherein the 'include' appears.  Class inheritance is used in that pattern strictly for its side effect of ensuring that the parent class is evaluated before even the parameter list of the child class.

To the best of my knowledge, class inheritance is still available in Puppet 4.  I am inclined to suspect that the wide use of the params class pattern is in fact a large part of the reason for that.


John

Dan Gibbons

unread,
Apr 13, 2015, 12:02:58 PM4/13/15
to puppet...@googlegroups.com
Ok thanks for the answers!

Dan
Reply all
Reply to author
Forward
0 new messages