Re: [Puppet Users] Using a variable in another variable name

2013-02-27 Thread Ti Leggett
Can you provide an example of using those safer functions in this case? On Feb 26, 2013, at 7:15 PM, Adrien Thebo wrote: > Using the scope.lookupvar or getvar functions would be greatly preferable; > using `eval` in this context is Really Bad (TM) and could produce some > extremely bad behavio

Re: [Puppet Users] Using a variable in another variable name

2013-02-26 Thread Adrien Thebo
Using the scope.lookupvar or getvar functions would be greatly preferable; using `eval` in this context is Really Bad (TM) and could produce some extremely bad behavior depending on the value of my_lan1. On Tue, Feb 26, 2013 at 1:11 PM, Ti Leggett wrote: > Nevermind. Figured this out: > > <% if

Re: [Puppet Users] Using a variable in another variable name

2013-02-26 Thread Ti Leggett
Nevermind. Figured this out: <% if defined?( eval "macaddress_" + my_lan1 -%> ... <% end -%> On Feb 26, 2013, at 10:16 AM, Ti Leggett wrote: > Is there a good way to check that the fact in question actually exists prior > to doing an eval? Doing the below when there is no 'my_lan1' fact produc

Re: [Puppet Users] Using a variable in another variable name

2013-02-26 Thread Ti Leggett
Is there a good way to check that the fact in question actually exists prior to doing an eval? Doing the below when there is no 'my_lan1' fact produces an error. On Feb 21, 2013, at 10:51 AM, windowsrefund wrote: > > <%= eval "macaddress_" + my_lan1 %> > > That will return the appropriate fa

[Puppet Users] Using a variable in another variable name

2013-02-21 Thread Ti Leggett
In a template, is there a way to use a variable to reference another variable name? For instance, let's say I have a variable 'interface', and in my template I want to reference @ipaddress_$interface so that when interface = 'eth0' I get the value of @ipaddress_eth0, but when interface = 'eth1'