Re: Manually creating class resource in site.pp works, calling same class from ENC silently fails

83 views
Skip to first unread message

Nick Fagerlund

unread,
Aug 23, 2012, 7:34:33 PM8/23/12
to puppet...@googlegroups.com


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?

Nick Fagerlund

unread,
Aug 23, 2012, 7:40:46 PM8/23/12
to puppet...@googlegroups.com
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.

Jon McKenzie

unread,
Aug 23, 2012, 8:37:24 PM8/23/12
to puppet...@googlegroups.com

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

Jon McKenzie

unread,
Aug 24, 2012, 9:11:57 AM8/24/12
to puppet...@googlegroups.com
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

Jon McKenzie

unread,
Aug 24, 2012, 11:21:39 AM8/24/12
to puppet...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages