I've come across an issue with facter 3, when using at_exit. Basically, any
at_exit blocks that refer to anything not in the top-level namespace
(pardon my terminology) trigger an 'uninitialized constant' NameError. I
think this is a namespace issue of some sort, but it's beyond my ken.

To recreate:
Create uninitialized.rb:
require 'facter'
at_exit { Facter.warn('Facter.warn at exit') }
at_exit { puts 'puts at exit' }
Facter.add('uninitialized_constant') do
  setcode do
    'foo'
  end
end

Run facter:
facter -p uninitialized_constant facterversion
facterversion => 3.1.4
uninitialized_constant => foo
puts at exit
/private/var/puppet/lib/facter/unint.rb:3:in `block in <top (required)>':
uninitialized constant Facter (NameError)

Note that the 'puts' at_exit works, but not the one using Facter.warn.

This works fine in facter 2:
$ sudo facter -p uninitialized_constant facterversion
facterversion => 2.4.4
uninitialized_constant => foo
puts at exit
Facter.warn at exit

I've put all this up at
https://gist.github.com/ccaviness/12b1db78c42283f4193a1709dd03a8ac

-- 
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/CANU2HrfPkoYcZcEWUioiTbyeN-60KfceZx3d1UX5XzdL3atSqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to