During a puppet-repl session any code that contains references to 
$server_facts would fail because those special facts did not carry across
node indirector calls.  I ended up reimplementing the assignment of the 
facts as suggested in order to provide these facts in the repl session.

Working example here: https://www.puppet-repl.com/play?content=vars

Another annoyance with the node indirector is that it does not populate the 
facts variable as it just merges all facts and variables into the 
parameters variable.   Any reason why this is done this way?

Corey

On Sunday, May 15, 2016 at 3:58:15 PM UTC-7, Henrik Lindberg wrote:
>
> On 15/05/16 23:53, Corey Osman wrote: 
> > Hi, 
> > 
> > I want to retrieve server_facts as documented below but the puppet node 
> > face doesn’t seem to create a variable called $server_facts in the facts 
> > hash. 
> > 
> > 
> https://docs.puppet.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#serverfacts-variable
>  
> > 
>
> It is the compiler indirection that sets those by doing add_server_facts 
> on the node. It first computes them by calling the private method 
> set_server_facts, which just remembers them in the compiler. 
>
> Then, when the compiler (the real one) starts compiling it ensure that 
> the variables are set up in top scope. 
>
> To get them (without copy/paste of the code in question and doing it 
> yourself, it is around 10-20 lines of code) you would probably need to 
> do a dummy compilation via a find catalog for a dummy node. Then get the 
> data from the node. 
>
> Not pretty. 
>
>
> > Is there a way to get this data via the node face? 
> > 
> > ie. puppet node find puppetdev.localdomain —terminus rest —render-as 
> yaml 
> > 
> > 
>
> Does not seem so. And why would it? The server facts are not part of the 
> node (even if technically they are delivered that way from one place to 
> another inside puppet - but that is mainly because it is hard to pass 
> information around when the indirector is involved). 
>
> What is it you are trying to do? 
>
> - 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 Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/5c68e1f8-e0be-4e84-b5a8-8b6a6aa02b58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to