On Fri, Apr 1, 2016 at 5:33 PM Peter Huene <peter.hu...@puppetlabs.com>
wrote:

> This is caused by how custom facts are resolved in Facter 3: namely that
> custom facts are resolved all at once and no further calls from Ruby into
> Facter's native implementation are expected when all resolutions have
> completed.  The Facter module removes itself from the Ruby runtime after
> all resolutions complete, but before the Ruby runtime is shutdown (when
> at_exit callbacks would occur).  This is why your at_exit callbacks can't
> find the Facter module; it's no longer there at that point.
>
>
Ah, interesting. Thanks.


> Looking things over, I believe it doesn't need to be implemented this way.
> The Facter module could outlive the Ruby runtime, allowing at_exit
> callbacks to still make use of Facter.  This would require that the native
> implementation not attempt to clean up explicit GC registrations made from
> the module, which should be entirely unnecessary anyway since the Ruby
> runtime has (in theory at least) destroyed the GC heap when the Ruby
> runtime is shutdown.
>
> I haven't seen at_exit used in a custom fact before, so I'm interested in
> your use case.  Given that I consider this behavior to be an implementation
> bug in Facter, would you mind opening a JIRA ticket at
> https://tickets.puppetlabs.com (project should be "FACT" for Facter) and
> detailing the use case?
>
>
We're using https://github.com/google/macops/blob/master/facter/cache.rb in
order to have some caching for long-resolving facts.

We have an at_exit call there to save the cached facts if they've changed.

I'll raise a ticket.

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

Reply via email to