I'm not sure if it's a bug or an expected behavior.
I have written a simple fact for a module that returns a version of a binary file, it executes: "binary --version" and then parses the version, no issues there, it works.
The issue i am having is relying on this fact in case the binary file gets upgraded during a package installation (this is the simple example)
package { 'package':
ensure => '1.3.8'
} ->
notify { "version: ${::binary_version}": }
If the previous version was 1.3.7 the fact "binary_version" will return 1.3.7, the next run it will return 1.3.8 as expected.
The biggest issue is if i rely on this fact to pick up a template to use, if this package is not yet installed the fact won't work and will work only on the second run.
I can only assume this happens because the facts are being "compiled" before the catalog is.
I have tried different ways to declare the relationship but it doesn't work.