On Feb 5, 2009, at 9:45 AM, Trevor Vaughan wrote:
>
> Benoit,
>
> If you want to globally change the value of a variable something that
> may either be a feature or a bug(?) is to pass it through an ERB and
> use a '!' ruby statement.
>
> It changes it in memory until the puppetmaster is restarted.
>
> I.e.
>
> $myvar = 'foo'
>
> define bar ($stupidvar = "nil" ) {
> stupidvar = template(changeglobal.erb)
> }
>
> --- changeglobal.erb ---
>
> <% myvar.gsub!(/^.*$/new string/) %>
>
> --- end ---
>
> It seems to work in 0.24.6, but heck if I know if it's supposed to.
Heh, nice. Yeah, Puppet's call-by-value, so if you modify the value,
the modification will stick. I can't see us ever changing that.
--
Don't throw away the old bucket until you know whether the new one
holds water. -- Swedish Proverb
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---