Jira (PUP-6776) document that all class and definition parameters are available as local variables (including meta parameters)

4 views
Skip to first unread message

Cody Herriges (JIRA)

unread,
Oct 4, 2016, 2:56:08 PM10/4/16
to puppe...@googlegroups.com
Cody Herriges created an issue
 
Puppet / Improvement PUP-6776
document that all class and definition parameters are available as local variables (including meta parameters)
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2016/10/04 11:55 AM
Priority: Normal Normal
Reporter: Cody Herriges

Adam Vinsh from the Puppet OpenStack module community brought up in IRC this morning that they discovered that they could use $require in the local scope of a defined type[1].

This got me wondering how local variables are generated from parameters and specifically how this intertwines with meta parameters. I was able to follow a path in the Puppet source that seemed to validate that all parameters of a resource are added to parameter scope[2] and that parameter scope will eventually make it into local scope by virtual of traveling through ephemeral scope[3]. Combine this with the specification that meta parameters are available in parameter scope[4] and it seems that you have an implicit behavior that one should expect that all meta parameters and their values are available in local scope.

[1] https://review.openstack.org/#/c/378950/10/manifests/service.pp
[2] https://github.com/puppetlabs/puppet/blob/master/lib/puppet/resource/type.rb#L347-L387
[3] https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/scope.rb#L928
[4] https://github.com/puppetlabs/puppet-specifications/blob/master/language/parameter_scope.md#meta-parameters-are-available-in-parameter-scope

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
Oct 4, 2016, 5:10:02 PM10/4/16
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-6776
 
Re: document that all class and definition parameters are available as local variables (including meta parameters)

So, I guess the question is really "are all meta parameters available in class and defines as variables, and are all of them defined in the parameter scope when evaluating default value expressions, or are there some meta parameters that are handled differently than the $title meta parameter that is shown in the specification (reference number [4])" - is that interpretation of the question correct?

Henrik Lindberg (JIRA)

unread,
Oct 4, 2016, 5:10:54 PM10/4/16
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
Oct 4, 2016, 5:11:23 PM10/4/16
to puppe...@googlegroups.com
 
Re: document that all class and definition parameters are available as local variables (including meta parameters)

For background: when I wrote the specification this was unclear, and there was not enough time at that point to do all of the detective work. Now that someone is seeking confirmation of the specified behaviour we should take the time and finish this.

Henrik Lindberg (JIRA)

unread,
Oct 4, 2016, 5:12:08 PM10/4/16
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
Oct 4, 2016, 5:28:24 PM10/4/16
to puppe...@googlegroups.com
 
Re: document that all class and definition parameters are available as local variables (including meta parameters)

The specification is also unclear on the fact that the parameter scope, once all parameters have received their values is available int the scope of the created entity.

Maggie Dreyer (JIRA)

unread,
May 16, 2017, 5:35:03 PM5/16/17
to puppe...@googlegroups.com

Maggie Dreyer (JIRA)

unread,
May 16, 2017, 5:35:03 PM5/16/17
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
May 31, 2017, 8:58:04 AM5/31/17
to puppe...@googlegroups.com

David McTavish (Jira)

unread,
Dec 1, 2021, 11:53:03 AM12/1/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Labels: final_triage
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

David McTavish (Jira)

unread,
Dec 6, 2021, 1:34:01 PM12/6/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages