Re: [Puppet Users] Variable Scoping: What do you want?

Gabriel Filion
2010-06-30T03:43:34Z

On 2010-06-29 19:47, Joe McDonagh wrote:
> On 06/29/2010 12:22 PM, Luke Kanies wrote:
>> Hi all,
>>
>> Given the number of threads on variable scoping recently, it''s
pretty
>> clear we need to change how it works.  Markus has a lot of this redone
>> in his futures branch, and I''m asking him to fully describe
what the
>> results will be when that''s merged, but my guess is that there
are
>> different expectations for what people want to see.
>>
>> So, my question is, what behaviour changes would you like to see in
>> how variable scoping works?  How would you like the edge cases that
>> are currently hurting you to behave?
>>
> Since order is not guaranteed, re-defining is kind of a no-go, but maybe
> some kind of ''final override'' keyword would work. Some
logic like "if
> var is defined, i don''t care, this value takes final
precedence." But
> you wouldn''t be able to have more than one ''final
override'' or whatever
> term you want to call it.
>
> Also, it would be *huge* to be able to append to vars. Right now I open
> fw ports via a variable in the node def like:
>
> $open_tcp_ports = "22,443"
>
> If I could always open 22 in the node def, but += inside classes for
> httpd, nfs, etc. things would be nice. I''m guessing this might be
a
> little difficult because all the variables in the  catalog would have to
> be assembled before applying the catalog.
>

I think the appending facility would be nice..
It could be something similar to virtual resources that you realize in a
precise place. Only, it would not be a resource, but a list that you
realize as a metaparameter or variable value.

And to go with that, having access to joining lists into a string
without having to use an inline template would be nice.

I think that collecting values inside a list from within any arbitrary
class, that should be used in one place is a not-so-edgy case that is
currently halted by class scopes.
Firewall rules, as Joe McDonagh mentioned, is one example. Another
example is nagios hostgroups/servicegroups.

--
Gabriel Filion