Thanks for the answer. That script is just an example, in my full script y fill both classes (parameters and classes), and when i run it prints a complete yaml Y also check in debug to see how puppet run de script, I run the same command with "sudo -su puppet" and works perfect. I also copy the yaml returned by de script and paste it into a simple shell script and works ok. Its like puppet doesn't like nodejs console.log.
I think i would need write my script in other language El sábado, 4 de enero de 2014 10:35:07 UTC-3, Jason Antman escribió: > > I *think* that "Empty response" is the issue here... your script appears > to be sending back YAML with just an (empty) classes hash and an (empty) > parameters hash. Try putting something in parameters (at least). Also make > sure that it's actually writing to STDOUT, not STDERR. > > Assuming neither of those are the problem... > > - Are you running the script as the same user that Puppet runs as? With > the same path? > - Does puppet.conf have the absolute path to the script? > - Are you *sure* you're calling it the same way puppet is? If you run your > puppetmaster in --debug mode, when a node checks in for its catalog, you > should see a log entry with the full path and arguments to the command > that's being run, like: > Debug: Executing '/etc/puppet/my_terminus.sh node_hostname.example.com' > - Are the permissions right (the script needs to be executable)? > > Generally when I've had problems like this, they've been either > permissions-related, or path-related (i.e. your script is #!/usr/bin/env > node, which assumes that node is actually in puppet's path). I'd recommend > doing a "sudo su - username" to the user that Puppet runs as, confirming > your env and path, and then trying the script. > > -Jason > > On 01/03/2014 09:16 AM, Jordan Cabral wrote: > > Hi, > Im writing a simple ENC in Nodejs. > When I run the script manually with some hostname it returns a valid YAML > (tested on http://yaml-online-parser.appspot.com/) > But when I run it from puppet I gen an error "Could not find node 'xxx'; > cannot compile" in the client > and "Empty response for hosname from exec terminus" when debugging the > master > > > I tested with a simple bash scipt with empty class and work ok: > ######################################################## > #!/bin/sh > > echo '--- > parameters: > ' > > exit 0 > > ######################################################## > > > > > *Nodejs script example:* > ######################################################## > #!/usr/bin/env node > > var yaml = require('js-yaml'); > > //Initialize ENC classes > var nodeParameters = {}; > var nodeClasses = {}; > > /* > Fill parameters and classes objects > */ > > var nodeConfig = {classes: nodeClasses, parameters: nodeParameters}; > console.log(yaml.safeDump(nodeConfig)); > process.exit(0); > ######################################################## > > > Some idea about what i'm doing wrong, or how can debug this error? > > Thanks! > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/7976eb3c-1f20-4d2c-98f4-3e19b33a8eca%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4b7a6234-347c-4e3b-aad3-36b3f5e2d2c4%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
