Re: [Puppet Users] Re: Fact is incorrect when show all facts, correct when on commandline

2015-02-09 Thread John D'Ausilio
Point taken on perl overkill .. trying to get something working and copy/pasted someone else's solution ;) In any case, I expect this to get all of the non-localhost interface names, sort them, and return me the IP address of the last in the list. When run from commandline by name it works great.

Re: [Puppet Users] Re: Fact is incorrect when show all facts, correct when on commandline

2015-02-09 Thread John D'Ausilio
Just to make sure .. simplified without perl .. [root@uc-01 ~]# cat /opt/wdts/puppet/production/modules/puppet/lib/facter/last_interface.rb Facter.add('last_interface') do setcode do name = Facter::Core::Execution.exec('ip -o l | grep -v loopback | sed \'s/://g\' | cut -d\' \' -f2 | sort -n

Re: [Puppet Users] Re: Fact is incorrect when show all facts, correct when on commandline

2015-02-09 Thread John D'Ausilio
I have more information .. it seems almost like facter is caching a stale result. While troubleshooting at the commandline I commented out the second line (Facter::value) and had it just return the name it was finding. After I made that change 'facter last_interface' returned the (correct)

[Puppet Users] Re: Fact is incorrect when show all facts, correct when on commandline

2015-02-09 Thread jcbollinger
On Sunday, February 8, 2015 at 3:47:58 PM UTC-6, John D'Ausilio wrote: 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

Re: [Puppet Users] Re: Fact is incorrect when show all facts, correct when on commandline

2015-02-09 Thread John Warburton
No idea what virtual box is doing, I'd try to keep it internal and use existing facts like interfaces, lop off the loopback interface and grab the last element of the array and use Facter.value as you are doing John On 10 February 2015 at 05:31, John D'Ausilio jdausi...@gmail.com wrote: I have