On Mon, May 23, 2011 at 3:51 PM, Aaron Grewell <aaron.grew...@gmail.com> wrote:
> I'm having a problem with variable interpolation that I haven't found a good
> solution to.  I want to use a variable as part of the name of a fact, but
> the interpolation doesn't work as expected.  I've allowed for passing the
> mac address into my define() but if it's not provided I want to look it up
> via facter.
>
>             if "$macaddress_${name}" {
>                 $final_hwaddr = "$macaddress_${name}"
>             }
>
> I want Puppet to look up the value of macaddress_eth0 or whatever, but
> instead it returns the value of $name.  How can I get the appropriate value?

Should be a function instead of inline_template:

$myvar = "macaddress_${name}"
$hwaddr = inline_template("<%= scope.lookupvar(myvar) %>")

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to