Re: [Puppet Users] variable scoping and erb templates

2016-08-16 Thread R.I.Pienaar


- Original Message -
> From: "Matt Zagrabelny" <mzagr...@d.umn.edu>
> To: "puppet-users" <puppet-users@googlegroups.com>
> Sent: Tuesday, 16 August, 2016 15:07:28
> Subject: Re: [Puppet Users] variable scoping and erb templates

> On Tue, Aug 16, 2016 at 8:04 AM, jcbollinger <john.bollin...@stjude.org> 
> wrote:
>>>
>>> On Tue, Aug 16, 2016 at 1:31 AM, Lowe Schmidt <m...@loweschmidt.se> wrote:
>>> > What version of Puppet are you running?
>>>
>>> Debian Jessie:
>>>
>>> 3.7.2-4
>>>
>>
>>
>> That looks like bug PUP-1220.  Note that although the ticket is marked as
>> being fixed in Puppet 3.5, commentary on the ticket and details of the
>> associated commit make me think that the fix only applies when you use the
>> future parser.
> 
> Thanks for clearing my confusion, John!

historically this is how puppet worked both in manifests and templates, that
got deprecated but for some reason templates didnt get the same treatment, 4
finished the job

> 
> Best,
> 
> -m
> 
> --
> 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/CAOLfK3W4DAqi9%3D63pwxGUO_jYQkcL6bnSMx_cePPN3z1dVyuyA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/164645949.512039.1471353775876.JavaMail.zimbra%40devco.net.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] variable scoping and erb templates

2016-08-16 Thread Matt Zagrabelny
On Tue, Aug 16, 2016 at 8:04 AM, jcbollinger  wrote:
>>
>> On Tue, Aug 16, 2016 at 1:31 AM, Lowe Schmidt  wrote:
>> > What version of Puppet are you running?
>>
>> Debian Jessie:
>>
>> 3.7.2-4
>>
>
>
> That looks like bug PUP-1220.  Note that although the ticket is marked as
> being fixed in Puppet 3.5, commentary on the ticket and details of the
> associated commit make me think that the fix only applies when you use the
> future parser.

Thanks for clearing my confusion, John!

Best,

-m

-- 
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/CAOLfK3W4DAqi9%3D63pwxGUO_jYQkcL6bnSMx_cePPN3z1dVyuyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] variable scoping and erb templates

2016-08-16 Thread jcbollinger


On Tuesday, August 16, 2016 at 7:06:28 AM UTC-5, Matt Zagrabelny wrote:
>
> Hi Lowe, 
>
> On Tue, Aug 16, 2016 at 1:31 AM, Lowe Schmidt  > wrote: 
> > What version of Puppet are you running? 
>
> Debian Jessie: 
>
> 3.7.2-4 
>
>

That looks like bug PUP-1220 
.  Note that although the 
ticket is marked as being fixed in Puppet 3.5, commentary on the ticket and 
details of the associated commit make me think that the fix only applies 
when you use the future parser.


John

-- 
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/4ca213ba-6572-473a-9624-0fc9d47942b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] variable scoping and erb templates

2016-08-16 Thread Matt Zagrabelny
Hi Lowe,

On Tue, Aug 16, 2016 at 1:31 AM, Lowe Schmidt  wrote:
> What version of Puppet are you running?

Debian Jessie:

3.7.2-4

-m

> --
> Lowe Schmidt | +46 723 867 157
>
> On 15 August 2016 at 20:48, Matt Zagrabelny  wrote:
>>
>> Greetings!
>>
>> I am hitting a curious question and couldn't find an answer.
>>
>> I can access variables from other classes when using an erb template.
>>
>> Here is my minimal example:
>>
>> # puppet apply variable_scope_test.pp
>> Notice: Compiled catalog for puppet.example.com in environment
>> production in 0.12 seconds
>> Notice: A variable from a different class:
>> Notice: /Stage[main]/Scope_example::Sub_class/Notify[A variable from a
>> different class: ]/message: defined 'message' as 'A variable from a
>> different class: '
>> Notice: Finished catalog run in 0.11 seconds
>>
>> # cd /tmp
>> # head -n -0 variable_scope_test.pp template.erb template_output
>> ==> variable_scope_test.pp <==
>> class scope_example {
>> $variable = "THIS IS A TEST!"
>> include scope_example::sub_class
>> }
>>
>> class scope_example::sub_class {
>> file { '/tmp/template_output':
>> content => template('/tmp/template.erb'),
>> }
>> notify { "A variable from a different class: $variable": }
>> }
>>
>> node 'puppet.example.com' {
>> include scope_example
>> }
>>
>> ==> template.erb <==
>> <%= @variable %>
>>
>> ==> template_output <==
>> THIS IS A TEST!
>>
>> So why is the template allowed to see variables in other classes?
>>
>> I would have ad expected to need to use the variable like:
>>
>> <%= @scope_example::variable %>
>>
>> But it clearly works without adjusting its namespace.
>>
>> Thoughts?
>>
>> Thanks!
>>
>> -m
>>
>> --
>> 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/CAOLfK3WBY9Hg%3DsaiHA2iAt4SRQjBX6XLsAJVj_qLGHJgjuugEg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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/CAC-wWcSmcHxSC5h169UOBiqq0HJTRtN7C4WfRbmnW02rHgx_OA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAOLfK3XcZQ3ck7ZN8BWf27OT8Oc-suk-hBXZ01v1uXLANQoxGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] variable scoping and erb templates

2016-08-16 Thread Lowe Schmidt
What version of Puppet are you running?

--
Lowe Schmidt | +46 723 867 157

On 15 August 2016 at 20:48, Matt Zagrabelny  wrote:

> Greetings!
>
> I am hitting a curious question and couldn't find an answer.
>
> I can access variables from other classes when using an erb template.
>
> Here is my minimal example:
>
> # puppet apply variable_scope_test.pp
> Notice: Compiled catalog for puppet.example.com in environment
> production in 0.12 seconds
> Notice: A variable from a different class:
> Notice: /Stage[main]/Scope_example::Sub_class/Notify[A variable from a
> different class: ]/message: defined 'message' as 'A variable from a
> different class: '
> Notice: Finished catalog run in 0.11 seconds
>
> # cd /tmp
> # head -n -0 variable_scope_test.pp template.erb template_output
> ==> variable_scope_test.pp <==
> class scope_example {
> $variable = "THIS IS A TEST!"
> include scope_example::sub_class
> }
>
> class scope_example::sub_class {
> file { '/tmp/template_output':
> content => template('/tmp/template.erb'),
> }
> notify { "A variable from a different class: $variable": }
> }
>
> node 'puppet.example.com' {
> include scope_example
> }
>
> ==> template.erb <==
> <%= @variable %>
>
> ==> template_output <==
> THIS IS A TEST!
>
> So why is the template allowed to see variables in other classes?
>
> I would have ad expected to need to use the variable like:
>
> <%= @scope_example::variable %>
>
> But it clearly works without adjusting its namespace.
>
> Thoughts?
>
> Thanks!
>
> -m
>
> --
> 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/CAOLfK3WBY9Hg%3DsaiHA2iAt4SRQjBX6XLsAJVj_
> qLGHJgjuugEg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAC-wWcSmcHxSC5h169UOBiqq0HJTRtN7C4WfRbmnW02rHgx_OA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] variable scoping and erb templates

2016-08-15 Thread Matt Zagrabelny
Greetings!

I am hitting a curious question and couldn't find an answer.

I can access variables from other classes when using an erb template.

Here is my minimal example:

# puppet apply variable_scope_test.pp
Notice: Compiled catalog for puppet.example.com in environment
production in 0.12 seconds
Notice: A variable from a different class:
Notice: /Stage[main]/Scope_example::Sub_class/Notify[A variable from a
different class: ]/message: defined 'message' as 'A variable from a
different class: '
Notice: Finished catalog run in 0.11 seconds

# cd /tmp
# head -n -0 variable_scope_test.pp template.erb template_output
==> variable_scope_test.pp <==
class scope_example {
$variable = "THIS IS A TEST!"
include scope_example::sub_class
}

class scope_example::sub_class {
file { '/tmp/template_output':
content => template('/tmp/template.erb'),
}
notify { "A variable from a different class: $variable": }
}

node 'puppet.example.com' {
include scope_example
}

==> template.erb <==
<%= @variable %>

==> template_output <==
THIS IS A TEST!

So why is the template allowed to see variables in other classes?

I would have ad expected to need to use the variable like:

<%= @scope_example::variable %>

But it clearly works without adjusting its namespace.

Thoughts?

Thanks!

-m

-- 
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/CAOLfK3WBY9Hg%3DsaiHA2iAt4SRQjBX6XLsAJVj_qLGHJgjuugEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.