The client's environment is stored as a fact. Facts are saved before the ENC is called. By default, they will be saved to /var/lib/puppet/yaml/facts/NODE_NAME/TIMESTAMP.yaml
An ENC can read a client's latest environment and other facts from this location. -Dan On Mon, Oct 17, 2011 at 8:25 AM, Mohamed Lrhazi <[email protected]> wrote: > To be clearer.. am asking about "ENC setting the environment", just > 'finding it out". > > > On Mon, Oct 17, 2011 at 11:23 AM, Mohamed Lrhazi <[email protected]> wrote: > > On Mon, Oct 17, 2011 at 8:53 AM, jcbollinger <[email protected]> > wrote: > >> > >> > >> On Oct 16, 6:38 pm, Mohamed Lrhazi <[email protected]> wrote: > >>> I tried to work around the problem by having a copy of the ENC per > >>> environment, which would work for me too... but then that does not > >>> work either: > >>> > >>> external_nodes = /etc/puppet/environments/$environment/gu-enc/gu-enc.py > >>> > >>> In the above, $environment evaluates to "production" even though my > >>> "puppet agent" call specified a different environment. > >>> > >>> I guess the above is evaluated on master's start up, only once, not > >>> per client invocation. > >>> > >>> Thanks a lot, > >>> Mohamed. > >>> > >>> On Sun, Oct 16, 2011 at 1:26 PM, Mohamed Lrhazi <[email protected]> > wrote: > >>> > Hello, > >>> > >>> > I started writing an ENC and run into what seems like a chicken and > >>> > egg problem... > >>> > >>> > I was starting off by getting the client's facts from the inventory > >>> > service by getting: > >>> > >>> >https://puppetmaster:8140/production/facts/$client_hostname > >>> > >>> > and then was getting the "environment" from the fact named > "environment" > >>> > >>> > then I realized that "production" in the previous URL is the > >>> > environment I am querying! > >>> > >>> > Is there another way of finding the environment that the client is > >>> > providing to the master? > >> > >> > >> The client may specify in its puppet.conf which environment it thinks > >> it is in (key 'environment'). The ENC may also specify which > >> environment a client is in by setting the variable "environment", but > >> see http://projects.puppetlabs.com/issues/3910 for problems related to > >> that. Your master can specify the default environment for nodes that > >> do not otherwise specify one, via the "environment" key in the > >> [master] section of their own puppet.conf. I'm not sure offhand > >> whether something like 3910 applies if the default is changed. This > >> is all covered in the External Nodes Guide and the puppet.conf > >> documentation. > >> > >> > > > > Thanks a lot John... I tried and could not find my answer in the docs. > > my specific question is: > > > > - When the master calls my ENC, it knows what the environment of the > > client is, regardless of where it got it from, right? > > - All the master passes to the ENC is the clients' cert name, nothing > else. > > > > My question is whether there is a way for the ENC to find that > > environment or not? > > > > Thanks a lot, > > Mohamed. > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
