On 17/05/16 02:37, Corey Osman wrote:
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

Glad that worked for you. I think that was the right decision.

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?


Poor judgement?

Jokes aside - it is pretty much Bouncy Castle all the way from a request comes in until it has passed the initial set up and can get down to just loading manifests and evaluating the catalog. Then the fun begins again on the path out to the agent.

Specifically, you can ask for a node for different purposes and in contexts where there are no scopes or variables. You don't know until you start compiling that you have those things for sure.

Once there were only global variables; no $facts - so all node parameters were simply set as variables. Once set there were no difference between those variables that came from the node's facts, and regular variables set in a manifest.

There is a similar situation with the nodes parameters - IIRC (and as you say) they are just mixed in to the node's parameters, and then become both global variables (for backwards compatibility reasons), and in $facts.

Hope that explains a bit and that it helps you.
Best,
- henrik

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
    
<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/
    <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
<mailto: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
<https://groups.google.com/d/msgid/puppet-dev/5c68e1f8-e0be-4e84-b5a8-8b6a6aa02b58%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

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/6299276b-ffe3-c659-f8bd-c7c44cfe61c8%40puppet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to