Hi Henrik,

Thanks for commenting. Could you elaborate "Only reference Facter in logic 
that implements facts" pls? Does it mean when defining, e.g. a custom-fact, 
it's okay to reference another fact but not anywhere else? People gave me 
so many advice about dos and don'ts but no one actually explain why it's 
not working or how can I do it. Regardless of it should be done or not, why 
it works for thing like *Facter.value(:hostname)* but not with like: 
*Facter.value(:my_external_fact)*?

Basically, I have some external facts setup, during the initial machine 
provisioning and then I wanna make sure those facts are defined, if not put 
those facts in the external_fact file with some default value. That 
template is to maintain that external_fact file - that's my case.

-San

On Wednesday, January 25, 2017 at 11:23:06 PM UTC, Henrik Lindberg wrote:

>
> Do not ever reference Facter directly on the master side from functions 
> or ERB templates used when compiling. Only reference Facter in logic 
> that implements facts. It should be safe to reference Facter on the 
> agent side in provider logic. 
>
> If you have been advised to use Facter directly in templates I would 
> like to know where that advice came from. 
>
> You want to reference @facts['factname'] in an ERB if you are on a 
> modern puppet, otherwise individual top scope variables. 
>
> - henrik 
>
>
> -- 
>
> Visit my Blog "Puppet on the Edge" 
> http://puppet-on-the-edge.blogspot.se/ 
>

-- 
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/e45d81c5-f66a-4c29-960b-c52cbc334486%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to