Kenneth Holter
2010-Jul-12  11:41 UTC
[Puppet Users] External nodes script does not work with multiple environments
Hi all.
I''m trying to set up puppetmaster with external node classifier and
multiple environments, and have found that the external nodes script
is only run if I don''t define any environments. Once I add an
environment to the /etc/puppet/puppet.conf file, the external nodes
script is no longer run. In my current setup I have the following
puppet.conf file:
-- code start --
[main]
    # Where Puppet stores dynamic and growing data.
    # The default value is ''/var/puppet''.
    vardir = /var/lib/puppet
    # The Puppet log directory.
    # The default value is ''$vardir/log''.
    logdir = /var/log/puppet
    # Where Puppet PID files are kept.
    # The default value is ''$vardir/run''.
    rundir = /var/run/puppet
    # Where SSL certificates are kept.
    # The default value is ''$confdir/ssl''.
    ssldir = $vardir/ssl
    environments = testing
[puppetd]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is ''$confdir/classes.txt''.
    classfile = $vardir/classes.txt
    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is ''$confdir/localconfig''.
    localconfig = $vardir/localconfig
[puppetmasterd]
    ssl_client_header = SSL_CLIENT_S_DN
    ssl_client_verify_header = SSL_CLIENT_VERIFY
    certificate_revocation = false
    external_nodes = /usr/bin/python /etc/puppet/tools/extlookup-satellite.py
    node_terminus = exec
[testing]
    manifest = /srv/puppet/testing/site.pp
    modulepath = /srv/puppet/testing/modules
-- code start --
If I comment out the last three lines, the external nodes script is
run (I''ve verified this by running "stat
<externa-nodes-script>"
before and after issuing a client request).
I''m kind of stuck, so advice on how to debug this will be greatly
apprecited.
Best regards,
Kenneth
-- 
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Nan Liu
2010-Jul-12  12:27 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
On Mon, Jul 12, 2010 at 7:41 AM, Kenneth Holter <kenneho.ndu@gmail.com>wrote:> In my current setup I have the following puppet.conf file: > > -- code start -- > [main] >...> environments = testing >Looking at the documentation and environments default thread ( http://groups.google.com/group/puppet-users/browse_thread/thread/f97bfad1e46c83c4?hl=en#), this line should be environment = testing to specify the default environment. The setting "environments=production,testing,development" belongs in the puppetmasterd section which controls which environments are allowed. [testing]> manifest = /srv/puppet/testing/site.pp > modulepath = /srv/puppet/testing/modules > -- code start -- > > If I comment out the last three lines, the external nodes script is > run (I''ve verified this by running "stat <externa-nodes-script>" > before and after issuing a client request). > > I''m kind of stuck, so advice on how to debug this will be greatly > apprecited. >We can try to tackle the issue from two sides and be more explicit about the environment, either check via puppetd --environment=testing, or in the YAML file produced by the external node classifier, ensure it return a line containing: environment: testing Thanks, Nan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kenneth Holter
2010-Jul-12  13:30 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
Thanks for your reply.
This is the line I''ve been running on the client side:
-- code start --
puppetd --server puppetmaster.example.local --environment=testing
--verbose --no-daemonize
-- code end --
I moved the "environments=testing" from "main" to
"puppetmasterd",
restarted puppetmaster, and tried another puppet client run. Same
results. Even tried without that entry, still don''t work.
I found a thread indicating that the site.pp file should contain a
default node, so I included this in /etc/puppet/manifests/site.pp:
-- code start --
node default {
   info("default node")
}
-- code end --
..and found that this is being parsed instead of puppetmaster fetching
the node information externally via the external nodes script. Any
ideas on how to proceed debugging this?
- Kenneth
On Mon, Jul 12, 2010 at 2:27 PM, Nan Liu <nan@puppetlabs.com>
wrote:> On Mon, Jul 12, 2010 at 7:41 AM, Kenneth Holter
<kenneho.ndu@gmail.com>
> wrote:
>>
>> In my current setup I have the following puppet.conf file:
>>
>> -- code start --
>> [main]
>
> ...
>>
>>    environments = testing
>
> Looking at the documentation and environments default thread
>
(http://groups.google.com/group/puppet-users/browse_thread/thread/f97bfad1e46c83c4?hl=en#),
> this line should be environment = testing to specify the default
> environment. The setting
"environments=production,testing,development"
> belongs in the puppetmasterd section which controls which environments are
> allowed.
>
>> [testing]
>>    manifest = /srv/puppet/testing/site.pp
>>    modulepath = /srv/puppet/testing/modules
>> -- code start --
>>
>> If I comment out the last three lines, the external nodes script is
>> run (I''ve verified this by running "stat
<externa-nodes-script>"
>> before and after issuing a client request).
>>
>> I''m kind of stuck, so advice on how to debug this will be
greatly
>> apprecited.
>
>
> We can try to tackle the issue from two sides and be more explicit about
the
> environment, either check via puppetd --environment=testing, or in the YAML
> file produced by the external node classifier, ensure it return a line
> containing:
>
> environment: testing
>
> Thanks,
>
> Nan
>
> --
> 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+unsubscribe@googlegroups.com.
> 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 puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Alan Barrett
2010-Jul-12  16:11 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
On Mon, 12 Jul 2010, Kenneth Holter wrote:> I''m trying to set up puppetmaster with external node classifier and > multiple environments, and have found that the external nodes script > is only run if I don''t define any environments. Once I add an > environment to the /etc/puppet/puppet.conf file, the external nodes > script is no longer run.You might be encountering bug #3580 (if the same client connects multiple times, then puppetmasterd runs the node classifier only once), or an issue related to filetimeout (by default, edits are noticed only 15 seconds later), or an interaction between the two. Kill and restart puppetmasterd to be sure you are testing the changes you think you are testing. --apb (Alan Barrett) -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nan Liu
2010-Jul-12  17:40 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
On Jul 12, 2010, at 8:30 AM, Kenneth Holter <kenneho.ndu@gmail.com> wrote:
I moved the "environments=testing" from "main" to
"puppetmasterd",
restarted puppetmaster, and tried another puppet client run. Same
results. Even tried without that entry, still don''t work.
What I meant was
[main]
...
environment=testing
[puppetmasterd]
...
environments=production,testing
I found a thread indicating that the site.pp file should contain a
default node, so I included this in /etc/puppet/manifests/site.pp:
-- code start --
node default {
 info("default node")
}
-- code end --
..and found that this is being parsed instead of puppetmaster fetching
the node information externally via the external nodes script. Any
ideas on how to proceed debugging this?
I would run "puppetd --configprint environment" to see what''s
the real
configuration after parsing. If it''s setting it to the testing
environment but not invoking external node, please run "puppetd
--configprint all | grep ldap" and forward a copy of the output.
If it''s a bug, definitely worth looking into and confirming.
Thanks,
Nan
Sent from my iPhone
-- 
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Kenneth Holter
2010-Jul-13  07:55 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
I''ve pasted the output of the suggested commands here: http://pastebin.com/npd6akwY I noticed that configprint shows that "extrenal_nodes" gets set to "none" as soon as I uncomment one of the environments (in this case "testing"). Is there any dependencies or something that the puppetmaster checks for with regards to environments, which may explain this behavior? Btw, I verified that the client picks up the correct environment when using the "--environment=<environments>" flag. And also, I restart the puppetmaster frequently when debugging this, so I don''t believe #3580 bug applies to me. - Kenneth On Mon, Jul 12, 2010 at 7:40 PM, Nan Liu <nan.liu@gmail.com> wrote:> On Jul 12, 2010, at 8:30 AM, Kenneth Holter <kenneho.ndu@gmail.com> wrote: > > I moved the "environments=testing" from "main" to "puppetmasterd", > > restarted puppetmaster, and tried another puppet client run. Same > > results. Even tried without that entry, still don''t work. > > What I meant was > [main] > ... > environment=testing > > [puppetmasterd] > ... > environments=production,testing > > I found a thread indicating that the site.pp file should contain a > > default node, so I included this in /etc/puppet/manifests/site.pp: > > -- code start -- > > node default { > > info("default node") > > } > > -- code end -- > > ..and found that this is being parsed instead of puppetmaster fetching > > the node information externally via the external nodes script. Any > > ideas on how to proceed debugging this? > > > I would run "puppetd --configprint environment" to see what''s the real > configuration after parsing. If it''s setting it to the testing > environment but not invoking external node, please run "puppetd > --configprint all | grep ldap" and forward a copy of the output. > > If it''s a bug, definitely worth looking into and confirming. > > Thanks, > > Nan > > Sent from my iPhone > > -- > 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+unsubscribe@googlegroups.com. > 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kenneth Holter
2010-Jul-13  12:50 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
After investigating further I''ve found this: When commenting out the environment stanza the puppet.conf file (in my case the "testing" environment), everything seems ok wrt (amongs others) these variables: [root@puppetmaster tmp]# puppetmasterd --no-daemonize --configprint all|egrep -i ''external|vardir|logdir|rundir'' external_nodes = /usr/bin/python /etc/puppet/tools/extlookup-satellite.py logdir = /var/log/puppet rundir = /var/run/puppet vardir = /var/lib/puppet When uncommenting the environement stanza, not only does the "external_nodes" variable change, but also the variables defined in the "main" stanza in puppet.conf: [root@puppetmaster tmp]# puppetmasterd --no-daemonize --configprint all|egrep -i ''external|vardir|logdir|rundir'' external_nodes = none logdir = /var/puppet/log rundir = /var/puppet/run vardir = /var/puppet So it looks like puppetmaster simply bypass the whole puppet.conf file (or at least the "main" and "puppetmasterd" stanzas). Any clues as to why the puppetmaster would skip the puppet.conf file? It seems possible that it performs some sort of syntax or semtatics check of some kind before it decides to bypass the file and go with other (default?) values, but if so I have noe clue on where the bug might be. - Kenneth On Tue, Jul 13, 2010 at 9:55 AM, Kenneth Holter <kenneho.ndu@gmail.com> wrote:> I''ve pasted the output of the suggested commands here: > http://pastebin.com/npd6akwY > > I noticed that configprint shows that "extrenal_nodes" gets set to > "none" as soon as I uncomment one of the environments (in this case > "testing"). Is there any dependencies or something that the > puppetmaster checks for with regards to environments, which may > explain this behavior? > > Btw, I verified that the client picks up the correct environment when > using the "--environment=<environments>" flag. And also, I restart the > puppetmaster frequently when debugging this, so I don''t believe #3580 > bug applies to me. > > > - Kenneth > > On Mon, Jul 12, 2010 at 7:40 PM, Nan Liu <nan.liu@gmail.com> wrote: >> On Jul 12, 2010, at 8:30 AM, Kenneth Holter <kenneho.ndu@gmail.com> wrote: >> >> I moved the "environments=testing" from "main" to "puppetmasterd", >> >> restarted puppetmaster, and tried another puppet client run. Same >> >> results. Even tried without that entry, still don''t work. >> >> What I meant was >> [main] >> ... >> environment=testing >> >> [puppetmasterd] >> ... >> environments=production,testing >> >> I found a thread indicating that the site.pp file should contain a >> >> default node, so I included this in /etc/puppet/manifests/site.pp: >> >> -- code start -- >> >> node default { >> >> info("default node") >> >> } >> >> -- code end -- >> >> ..and found that this is being parsed instead of puppetmaster fetching >> >> the node information externally via the external nodes script. Any >> >> ideas on how to proceed debugging this? >> >> >> I would run "puppetd --configprint environment" to see what''s the real >> configuration after parsing. If it''s setting it to the testing >> environment but not invoking external node, please run "puppetd >> --configprint all | grep ldap" and forward a copy of the output. >> >> If it''s a bug, definitely worth looking into and confirming. >> >> Thanks, >> >> Nan >> >> Sent from my iPhone >> >> -- >> 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+unsubscribe@googlegroups.com. >> 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Alan Barrett
2010-Jul-13  14:49 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
On Tue, 13 Jul 2010, Kenneth Holter wrote:> So it looks like puppetmaster simply bypass the whole puppet.conf file > (or at least the "main" and "puppetmasterd" stanzas).I think there was a bug report about puppet.conf being ignored if it contained errors; but I can''t find the bug report, and I don''t see any errors in your config. --apb (Alan Barrett) -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kenneth Holter
2010-Jul-14  08:17 UTC
Re: [Puppet Users] External nodes script does not work with multiple environments
Yay, I got it working now. Your reply lead me to bug #3514, so I decided to extraced a fresh puppet.conf from the puppet-server RPM, and add my modifications to it (no copy and paste). Now it works, so it''s possible that it was a CR/LF ending issue (if so I must have pasted code from outlook or something). Thanks for your help! - Kenneth On Tue, Jul 13, 2010 at 4:49 PM, Alan Barrett <apb@cequrux.com> wrote:> On Tue, 13 Jul 2010, Kenneth Holter wrote: >> So it looks like puppetmaster simply bypass the whole puppet.conf file >> (or at least the "main" and "puppetmasterd" stanzas). > > I think there was a bug report about puppet.conf being ignored > if it contained errors; but I can''t find the bug report, and > I don''t see any errors in your config. > > --apb (Alan Barrett) > > -- > 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+unsubscribe@googlegroups.com. > 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.