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

Matt
2010-07-04T22:04:20Z

On 2 July 2010 09:50, David Schmitt <david@dasz.at>
wrote:
> On 6/30/2010 10:57 AM, Matt wrote:
>>
>> On 29 June 2010 17:22, Luke Kanies<luke@puppetlabs.com>  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?
>>>
>>
>> I''d like to see the ability to reference and change variables
from
>> other classes.
>>
>> class httpd { $monitor::services += ''httpd1'' }
>> class nginx { $monitor::services += ''nginx'' }
>>
>> And if $monitor::services doesn''t exist then it''s
just created with
>> one of the above rather than having to specify $monitor::services = []
>>
>> Or use the new staging feature for ordering where I could do:
>>
>> stage 1 includes class monitor { $monitor::services = [] }
>> stage 2 includes class httpd, nginx as above
>
> How is $monitor::service used, that this cannot read
>
>  class httpd { monitor::service { ''httpd1'': } }
>  class nginx { monitor::service { ''nginx'': } }
>
> ?

$monitor::service is used to monitor all services that are in that
array.  So node include monitor, httpd, nginx

class monitor { deploy monitoring for all services in $monitor::service }

Being able to do if $monitor::service includes(httpd) would also be cool.

Matt