On Oct 16, 6:38 pm, Mohamed Lrhazi <lrh...@gmail.com> 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 <lrh...@gmail.com> 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. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.