Jon McKenzie
2012-Aug-23 20:12 UTC
[Puppet Users] Manually creating class resource in site.pp works, calling same class from ENC silently fails
I have a simple class, call it "foobar". It has two simple resources, a file and an augeas call to edit sysctl.conf. When I run my ENC script against a node, the class appears in the resulting YAML, e.g. --- classes: foobar: {} However, when I call ''puppetd --test'' on the client side, this class is not included in the catalog. If I cat classes.txt, it''s also not listed. There are no error messages. I''ve enabled trace logging for my puppetmaster, and I also do not see anything erroneous. I should note that I have other classes hooked up through my ENC for the exact same node, and they are working fine. Now, if I manually create this class as a resource, e.g. "class { "foobar": }" in my site.pp, the class gets compiled and runs just fine. I''m running puppet 2.7.18-1 from the puppetlabs-provided RPMs. Is there a way on the server side to validate the ENC -> class transformation for clients? I can see in the logs when the ENC script gets run, but there''s not much other detail Thanks! Jon -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/vkeKbjdht24J. 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.
Nick Fagerlund
2012-Aug-23 23:34 UTC
[Puppet Users] Re: Manually creating class resource in site.pp works, calling same class from ENC silently fails
On Thursday, August 23, 2012 1:12:03 PM UTC-7, Jon McKenzie wrote:> > --- > classes: > foobar: {} > > >That looks wrong. Cf. http://docs.puppetlabs.com/guides/external_nodes.html#puppet-265-and-higher It should be: --- classes: foobar: ...without the curlies. Does it work if you kill those brackets? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/vi3Gv0nKnqQJ. 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.
Nick Fagerlund
2012-Aug-23 23:40 UTC
[Puppet Users] Re: Manually creating class resource in site.pp works, calling same class from ENC silently fails
Oh wait, also! On Thursday, August 23, 2012 1:12:03 PM UTC-7, Jon McKenzie wrote:> > > Is there a way on the server side to validate the ENC -> class > transformation for clients? I can see in the logs when the ENC script gets > run, but there''s not much other detail > > >Yeah, get the node object at the command line on your puppet master. $ sudo puppet node find screech.magpie.lan --mode master --render-as yaml ...where screech.magpie.lan is the node name. It''ll have a ''classes'' key which will be either an array or a hash depending on how your ENC was rigged. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/XFb_9tdePrwJ. 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.
Jon McKenzie
2012-Aug-24 00:37 UTC
[Puppet Users] Re: Manually creating class resource in site.pp works, calling same class from ENC silently fails
> > > It should be: > > --- > classes: > foobar: > > >I thought the {} might be the issue too, however that* is* valid YAML (my ENC is a ruby script that just calls .to_yaml on a constructed hash). If that''s indeed the issue, I think that should probably be considered a bug. I think whatever''s taking the output of the ENC should not get confused between a nil and an empty hash (what happened to duck typing? :-)) I will try it tomorrow. However if I remember correctly (I was bogged down with other things yesterday as well), I did try passing dummy parameters too, e.g. --- classes: foobar: foo: bar ... and this also did not work. And thanks for the puppet node command! I did not know about that. I''ll give that a go as well On Thursday, August 23, 2012 7:40:46 PM UTC-4, Nick Fagerlund wrote:> > Oh wait, also! > > On Thursday, August 23, 2012 1:12:03 PM UTC-7, Jon McKenzie wrote: >> >> >> Is there a way on the server side to validate the ENC -> class >> transformation for clients? I can see in the logs when the ENC script gets >> run, but there''s not much other detail >> >> >> > Yeah, get the node object at the command line on your puppet master. > > $ sudo puppet node find screech.magpie.lan --mode master --render-as yaml > > ...where screech.magpie.lan is the node name. It''ll have a ''classes'' key > which will be either an array or a hash depending on how your ENC was > rigged. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/vy0CAL46eE8J. 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.
Jon McKenzie
2012-Aug-24 13:11 UTC
[Puppet Users] Re: Manually creating class resource in site.pp works, calling same class from ENC silently fails
I altered my ENC script to get rid of the {} on empty params, and instead follow what''s prescribed in the documentation. Still no good. Also, if I run the puppet node command you gave me on the master, the classes appear correct. When I run ''puppet --test --noop'' on the client, though, it still is only getting a subset of the defined ENC classes. I''ve tried stopping and restarting the web server as well, which doesn''t appear to have any effect. I''m not sure what''s going on On Thursday, August 23, 2012 8:37:24 PM UTC-4, Jon McKenzie wrote:> > >> It should be: >> >> --- >> classes: >> foobar: >> >> >> > I thought the {} might be the issue too, however that* is* valid YAML (my > ENC is a ruby script that just calls .to_yaml on a constructed hash). If > that''s indeed the issue, I think > that should probably be considered a bug. I think whatever''s taking the > output of the ENC should not get confused between a nil and an empty hash > (what happened to duck typing? :-)) > > I will try it tomorrow. However if I remember correctly (I was bogged down > with other things yesterday as well), I did try passing dummy parameters > too, e.g. > > --- > classes: > foobar: > foo: bar > > ... and this also did not work. > > And thanks for the puppet node command! I did not know about that. I''ll > give that a go as well > > On Thursday, August 23, 2012 7:40:46 PM UTC-4, Nick Fagerlund wrote: >> >> Oh wait, also! >> >> On Thursday, August 23, 2012 1:12:03 PM UTC-7, Jon McKenzie wrote: >>> >>> >>> Is there a way on the server side to validate the ENC -> class >>> transformation for clients? I can see in the logs when the ENC script gets >>> run, but there''s not much other detail >>> >>> >>> >> Yeah, get the node object at the command line on your puppet master. >> >> $ sudo puppet node find screech.magpie.lan --mode master --render-as yaml >> >> ...where screech.magpie.lan is the node name. It''ll have a ''classes'' key >> which will be either an array or a hash depending on how your ENC was >> rigged. >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/OUlNoARM7DsJ. 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.
Jon McKenzie
2012-Aug-24 15:21 UTC
[Puppet Users] Re: Manually creating class resource in site.pp works, calling same class from ENC silently fails
Hi, I found what my issue was. I knew it would likely be something silly (it almost always is.. ). Basically my ENC reads out of a set of YAML files to determine a node''s configuration. The particular class wasn''t working because its YAML config was 0640 and not 0644. My ENC script will silently skip the YAML config if it isn''t readable (will now remedy that..). Thanks for your help -Jon On Friday, August 24, 2012 9:11:57 AM UTC-4, Jon McKenzie wrote:> > I altered my ENC script to get rid of the {} on empty params, and instead > follow what''s prescribed in the documentation. Still no good. > > Also, if I run the puppet node command you gave me on the master, the > classes appear correct. When I run ''puppet --test --noop'' on the client, > though, it still is only getting a subset of the defined ENC classes. > > I''ve tried stopping and restarting the web server as well, which doesn''t > appear to have any effect. > > I''m not sure what''s going on > > On Thursday, August 23, 2012 8:37:24 PM UTC-4, Jon McKenzie wrote: >> >> >>> It should be: >>> >>> --- >>> classes: >>> foobar: >>> >>> >>> >> I thought the {} might be the issue too, however that* is* valid YAML >> (my ENC is a ruby script that just calls .to_yaml on a constructed hash). >> If that''s indeed the issue, I think >> that should probably be considered a bug. I think whatever''s taking the >> output of the ENC should not get confused between a nil and an empty hash >> (what happened to duck typing? :-)) >> >> I will try it tomorrow. However if I remember correctly (I was bogged >> down with other things yesterday as well), I did try passing dummy >> parameters too, e.g. >> >> --- >> classes: >> foobar: >> foo: bar >> >> ... and this also did not work. >> >> And thanks for the puppet node command! I did not know about that. I''ll >> give that a go as well >> >> On Thursday, August 23, 2012 7:40:46 PM UTC-4, Nick Fagerlund wrote: >>> >>> Oh wait, also! >>> >>> On Thursday, August 23, 2012 1:12:03 PM UTC-7, Jon McKenzie wrote: >>>> >>>> >>>> Is there a way on the server side to validate the ENC -> class >>>> transformation for clients? I can see in the logs when the ENC script gets >>>> run, but there''s not much other detail >>>> >>>> >>>> >>> Yeah, get the node object at the command line on your puppet master. >>> >>> $ sudo puppet node find screech.magpie.lan --mode master --render-as yaml >>> >>> ...where screech.magpie.lan is the node name. It''ll have a ''classes'' >>> key which will be either an array or a hash depending on how your ENC was >>> rigged. >>> >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Y2v6Z1IcebgJ. 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.