Hi, I'm trying to get a fact into a file.  It worked fine in puppet 3.0.2 
but now with 4.4 it doesn't work.  It seems I'm not understanding the new 
syntax or maybe the scope level too?

As I was writing this I figured out the solution and am including it here 
in case others come across the same problem.  Nested facts aren't 
documented in the puppet docs, only first level facts.

Problem:
This line returns a blank instead of the mac address.
HWADDR="<%= scope.lookupvar('::networking::interfaces::eth0::mac') %>"

This line is also blank
HWADDR="<%= scope['::networking::interfaces::eth0::mac'] %>"

I've also tried this but it is also blank
HWADDR="<%= @mac %>"

If I use I try this it works and I get the facter version
HWADDR="<%= @facterversion %>"

but this doesn't
HWADDR="<%= ::facterversion %>"

====================================================================

Solution:  
HWADDR="<%= scope['networking']['interfaces']['eth0']['mac'] %>"

=====================================================================
host facter results

networking => {
  dhcp => "192.168.16.5",
  domain => "example.com",
  fqdn => "s1.example.com",
  hostname => "s1",
  interfaces => {
    eth0 => {
      dhcp => "192.168.16.5",
      mac => "00:xx:xx:xx:xx:c2",
      mtu => 1500
}

=====================================================================
file I'm trying to change

DEVICE="eth0"
HWADDR="<%= scope.lookupvar('::networking::interfaces::eth0::mac') %>"  
#this line not working
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
USERCTL=no
IPV6INIT=no


-- 
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/278d3960-727e-461e-81e9-cd0fcf132cfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to