Cosimo Streppone
2011-Jan-07 14:51 UTC
[Puppet Users] My external node classifier script is totally ignored
Hi, I just added an external classifier script, and things are not working as I expected to. Trying to read documentation about ext.nodes and searching the archives I couldn''t come up with any useful results. My classifier script outputs: --- YAML --- classes: - geodns::production::backend environment: production name: z01-06-02 parameters: puppet_server: z01-06-02 This is both master and client. While debugging with --trace --debug, etc.. I noticed that: - the ext node script is invoked and produces the correct result - if I remove my "geodns::production::backend" .pp file or I put a deliberate error in it, puppet rightly complains, so it is looking them up. Only when I modify my site.pp to manually include the given node, then everything starts to work just fine. This is my working site.pp: $server = "z01-06-02.mydomain.com" import "os/*.pp" import "classes/*.pp" import "classes/*/*.pp" node default { include basenode } # This is the part I thought ext node script would "replace" node ''z01-06-02.mydomain.com'' { include geodns::production::backend } # etc... Any idea? This is 2.6.2. -- Cosimo -- 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.
Rameses Mss
2011-Jan-07 22:17 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
On Fri, Jan 7, 2011 at 9:51 AM, Cosimo Streppone <cosimo@streppone.it>wrote:> Hi, > > I just added an external classifier script, and things > are not working as I expected to. > > Trying to read documentation about ext.nodes and > searching the archives I couldn''t come up with any > useful results. > > My classifier script outputs: > > --- YAML > --- > classes: > - geodns::production::backend > environment: production > name: z01-06-02 > parameters: > puppet_server: z01-06-02 > > This is both master and client. > > While debugging with --trace --debug, etc.. I noticed that: > > - the ext node script is invoked and produces the correct result > - if I remove my "geodns::production::backend" .pp file or I put > a deliberate error in it, puppet rightly complains, so it is > looking them up. > > Only when I modify my site.pp to manually include the > given node, then everything starts to work just fine. > This is my working site.pp: > > $server = "z01-06-02.mydomain.com" > > import "os/*.pp" > import "classes/*.pp" > import "classes/*/*.pp" > > node default { > include basenode > } > > # This is the part I thought ext node script would "replace" > node ''z01-06-02.mydomain.com'' { > include geodns::production::backend > } > > # etc... > > Any idea? >I believe that to use an external nodes script you may only (and must) have a default node in nodes.pp. Try commenting out the rest of your nodes and see if the external script is respected. -- 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.
Cosimo Streppone
2011-Jan-07 22:26 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
In data 07 gennaio 2011 alle ore 23:17:10, Rameses Mss <rmss60287@gmail.com> ha scritto:> On Fri, Jan 7, 2011 at 9:51 AM, Cosimo Streppone > <cosimo@streppone.it>wrote: > >> Only when I modify my site.pp to manually include the >> given node, then everything starts to work just fine. >> This is my working site.pp: >> >> $server = "z01-06-02.mydomain.com" >> >> import "os/*.pp" >> import "classes/*.pp" >> import "classes/*/*.pp" >> >> node default { >> include basenode >> } >> >> # This is the part I thought ext node script would "replace" >> node ''z01-06-02.mydomain.com'' { >> include geodns::production::backend >> } >> >> # etc... >> >> Any idea? > > I believe that to use an external nodes script you may only (and must) > have a default node in nodes.pp. Try commenting out the rest of your > nodes and > see if the external script is respected.Mmh... that''s what I started with, actually. Just the default node: node default { include basenode } but that ignores the external classifier. Only explicitly adding the "z01..." node makes it work just fine. With that I mean that the external classifier is invoked, but totally ignored, so z01-06-02 gets just the "basenode" class definition, not geodns::production::backend, as the external classifier specified. -- Cosimo -- 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.
Nigel Kersten
2011-Jan-08 19:07 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
Is between "====" exactly what you''re printing out? ================ --- YAML --- classes: - geodns::production::backend environment: production name: z01-06-02 parameters: puppet_server: z01-06-02 ================= You shouldn''t have the first line there, and testing shows it''s not getting parsed correctly, but that should have been noted in the logs somewhere. Is there no warning about not being able to parse the output of the node classifier? # saved contents to /tmp/input.yaml $ irb>> require ''yaml''=> true>> YAML.load_file("/tmp/input.yaml")ArgumentError: syntax error on line 4, col 1: ` environment: production'' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load'' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load'' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:144:in `load_file'' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:143:in `open'' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:143:in `load_file'' from (irb):2 # remove first line.>> YAML.load_file("/tmp/input.yaml")=> {"name"=>"z01-06-02", "parameters"=>{"puppet_server"=>"z01-06-02"}, "classes"=>["geodns::production::backend"], "environment"=>"production"} -- 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.
Cosimo Streppone
2011-Jan-08 20:17 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
In data 08 gennaio 2011 alle ore 20:07:20, Nigel Kersten <nigel@puppetlabs.com> ha scritto:> Is between "====" exactly what you''re printing out? > > ================> --- YAML > --- > classes: > - geodns::production::backend > environment: production > name: z01-06-02 > parameters: > puppet_server: z01-06-02 > =================Yes, that''s the standard perl YAML serializer.> You shouldn''t have the first line there, and testing shows it''s not > getting parsed correctlyOk, then I''ll find a way to remove it. No problem.> but that should have been noted in the logs > somewhere. Is there no warning about not being able to parse the > output of the node classifier?Not really, no. I''ll double check, but I haven''t noticed any problem in at least 20-30 runs.>>> YAML.load_file("/tmp/input.yaml") > => {"name"=>"z01-06-02", "parameters"=>{"puppet_server"=>"z01-06-02"}, > "classes"=>["geodns::production::backend"], > "environment"=>"production"}Thanks, very helpful! -- Cosimo -- 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.
Daniel Pittman
2011-Jan-08 20:36 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
On Sat, Jan 8, 2011 at 12:17, Cosimo Streppone <cosimo@streppone.it> wrote:> In data 08 gennaio 2011 alle ore 20:07:20, Nigel Kersten > <nigel@puppetlabs.com> ha scritto: > >> Is between "====" exactly what you''re printing out? >> >> ================>> --- YAML >> --- >> classes: >> - geodns::production::backend >> environment: production >> name: z01-06-02 >> parameters: >> puppet_server: z01-06-02 >> =================> > Yes, that''s the standard perl YAML serializer.Hrm. A quick test here with YAML.pm 0.72 does the right thing, which is that it does not emit that extra line. It might be worth looking into that, because that does indicate that your stream contains *two* documents - each ''---'' separator starts an entire document and all. When you say the standard serializer, that actually shifted in the last couple of years, so when I was using it there was a move from YAML::Syck to YAML::XS, then to YAML which would do way more magic. Might be worth checking that out, or upgrading the module on the classifier machine. Regards, Daniel -- ✉ Daniel Pittman <daniel@rimspace.net> ⌨ daniel@rimspace.net (XMPP) ☎ +1 503 893 2285 ♻ made with 100 percent post-consumer electrons -- 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.
Nigel Kersten
2011-Jan-09 01:49 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
On Sat, Jan 8, 2011 at 12:17 PM, Cosimo Streppone <cosimo@streppone.it> wrote:> In data 08 gennaio 2011 alle ore 20:07:20, Nigel Kersten > <nigel@puppetlabs.com> ha scritto: > >> Is between "====" exactly what you''re printing out? >> >> ================>> --- YAML >> --- >> classes: >> - geodns::production::backend >> environment: production >> name: z01-06-02 >> parameters: >> puppet_server: z01-06-02 >> =================> > Yes, that''s the standard perl YAML serializer. > >> You shouldn''t have the first line there, and testing shows it''s not >> getting parsed correctly > > Ok, then I''ll find a way to remove it. No problem. > >> but that should have been noted in the logs >> somewhere. Is there no warning about not being able to parse the >> output of the node classifier? > > Not really, no. > I''ll double check, but I haven''t noticed any problem > in at least 20-30 runs.This makes sense now. There is a valid YAML document "-- YAML", it''s being parsed, not finding a valid node definition, and falling back to your manually defined node.> >>>> YAML.load_file("/tmp/input.yaml") >> >> => {"name"=>"z01-06-02", "parameters"=>{"puppet_server"=>"z01-06-02"}, >> "classes"=>["geodns::production::backend"], >> "environment"=>"production"} > > Thanks, very helpful! > > -- > Cosimo > > -- > 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.
Cosimo Streppone
2011-Jan-09 12:18 UTC
Re: [Puppet Users] My external node classifier script is totally ignored
In data 08 gennaio 2011 alle ore 21:36:48, Daniel Pittman <daniel@rimspace.net> ha scritto:> On Sat, Jan 8, 2011 at 12:17, Cosimo Streppone <cosimo@streppone.it> > wrote: >> In data 08 gennaio 2011 alle ore 20:07:20, Nigel Kersten >> <nigel@puppetlabs.com> ha scritto: >> >>> Is between "====" exactly what you''re printing out? >>> >>> ================>>> --- YAML >>> --- >>> classes: >>> - geodns::production::backend >>> environment: production >>> name: z01-06-02 >>> parameters: >>> puppet_server: z01-06-02 >>> =================>> >> Yes, that''s the standard perl YAML serializer. > > Hrm. A quick test here with YAML.pm 0.72 does the right thing, which > is that it does not emit that extra line. It might be worth looking > into that, because that does indicate that your stream contains *two* > documents - each ''---'' separator starts an entire document and all.I found there was a problem in my classifier script. I was doing: # ... my $puppet_classifier_info = { classes => $puppet_class, environment => ''production'', parameters => \%default_params, }; print YAML->Dump($puppet_classifier_info); While the correct statement is: print YAML::Dump($puppet_classifier_info); As you suggested, that doesn''t output the additional ''--- YAML'' line. I didn''t have time to try this yet, but it''s clear that it''s going to work. Yay! -- Cosimo -- 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.