Ok, so the workaround is to use a variable (set default), if that fails, try the fact.
Thanks! On Thursday, October 6, 2016 at 10:45:26 AM UTC+3, R.I. Pienaar wrote: > > > > ----- Original Message ----- > > From: "Erez Zarum" <[email protected] <javascript:>> > > To: "puppet-users" <[email protected] <javascript:>> > > Sent: Thursday, 6 October, 2016 09:40:44 > > Subject: [Puppet Users] Facts and Resource relationships > > > 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. > > yes, you cant use facts for something that changes during a run. It's for > facts > about your node that influence the creation of the catalog. > > things the catalog changes - well thats after the catalog was created > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/1af175d0-ba5d-4626-8fcc-986f6c7fc8f3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
