So I have a custom fact which works fine from the commandline: facter 
last_interface  (it returns the ip address of the last of a sorted list of 
interface names)

If I just run facter without parameters, the value in last_interface is 
incorrect!

Is there something different between the environment when running facter 
without args and the environment when asking for a specific fact?

Facter.add('last_interface') do
  setcode do
    name = Facter::Core::Execution.exec('ip -o l | grep -v loopback | perl 
-lane\'$F[1]=~s/://g;print $F[1]\' | sort -n | tail -1')
    Facter.value("ipaddress_"+name)
  end
end

-- 
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/0e236340-f828-4686-8e98-89cbba784ccf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to