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 <[email protected]> wrote: > Nevermind. Figured this out: > > <% if defined?( eval "macaddress_" + my_lan1 -%> > ... > <% end -%> > > On Feb 26, 2013, at 10:16 AM, Ti Leggett <[email protected]> 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 > produces an error. > > > > On Feb 21, 2013, at 10:51 AM, windowsrefund <[email protected]> > wrote: > > > >> > >> <%= eval "macaddress_" + my_lan1 %> > >> > >> That will return the appropriate fact based on the value of my_lan1 > >> > >> -- > >> 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 [email protected]. > >> To post to this group, send email to [email protected]. > >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Adrien Thebo | Puppet Labs -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
