Warning: Unable to fetch my node definition, but the agent run will continue:

11,147 views
Skip to first unread message

Shawn Parker

unread,
Nov 26, 2013, 8:01:38 PM11/26/13
to puppet...@googlegroups.com
I am getting the following error when executing puppet agent --test from the node to force it to get its node definition

[root@localhost puppet]# puppet agent --test
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 400 on SERVER: Failed to find puppetnode.localdomain via exec: Execution of '/etc/puppet/snc_enc.py puppetnode.localdomain' returned 1:
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed when searching for node puppetnode.localdomain: Failed to find puppetnode.localdomain via exec: Execution of '/etc/puppet/snc_enc.py puppetnode.localdomain' returned 1:
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

I am using an external node classifier, not sure what I am doing wrong

Felix Frank

unread,
Nov 27, 2013, 5:54:46 AM11/27/13
to puppet...@googlegroups.com
Hi,

On 11/27/2013 02:01 AM, Shawn Parker wrote:
> Error: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Failed when searching for node puppetnode.localdomain: Failed to
> find puppetnode.localdomain via exec: Execution of
> '/etc/puppet/snc_enc.py puppetnode.localdomain' returned 1:
> I am using an external node classifier, not sure what I am doing wrong

the ENC either does not work correctly, or the FQDN is not classified.

What happens when you run

/etc/puppet/snc_enc.py puppetnode.localdomain

on the master? Take special notice of the return code.

If it does work - how about with the permissions of the master process
(i.e., user puppet)?

HTH,
Felix

Szerémi Attila

unread,
Jan 31, 2014, 12:49:10 PM1/31/14
to puppet...@googlegroups.com
I had this same issue. It seemed like the very first warning was the key.

By adding the hostname that my own agent server was configured as to /etc/hosts as 127.0.0.1, all the errors went away and the command ran successfully.

Dale Bradman

unread,
Oct 5, 2015, 10:45:34 AM10/5/15
to Puppet Users
Hi Szerémi,

I am new to Puppet. Could you explain this a little more please?

I have my Puppet master and the node I am trying to run 'puppet agent --test' on however I am seeing the same error as Shawn.

Which /etc/hosts file are you talking about - puppet master or the node?

Thanks.

jcbollinger

unread,
Oct 6, 2015, 9:52:38 AM10/6/15
to Puppet Users


On Monday, October 5, 2015 at 9:45:34 AM UTC-5, Dale Bradman wrote:
Hi Szerémi,

I am new to Puppet. Could you explain this a little more please?

I have my Puppet master and the node I am trying to run 'puppet agent --test' on however I am seeing the same error as Shawn.



To expand on Felix's diagnosis, Shawn's Puppet master is configured to use an "external node classifier" (ENC), which is an external program provided by the site (sometimes via a separate pre-packaged utility such as The Foreman) or provided as part of the Puppet Enterprise package.  When so configured, the master will run the ENC for each catalog request it receives, passing it the requesting node's name (which by default is its hostname), and expecting to receive back YAML-formatted data describing classes that should be applied to the node and global variable values that apply to it.

In Shawn's case, the ENC is returning an error code when run with argument 'puppetnode.localdomain', which apparently is the node's self-reported name, as borne by its certificate.  Why an error occurs depends entirely on the particular ENC program in use, but at a high level there are only two possibilities:
  1. the ENC doesn't know how to classify the specified node, or
  2. the ENC encountered an internal error.
One plausible reason for such a failure is that the ENC itself needs to be configured with information about the node in question.  Another is that it is currently misconfigured -- for example, perhaps it disagrees with the node about the node's name.


John

khamru munnu

unread,
Oct 15, 2016, 12:54:58 PM10/15/16
to Puppet Users
Hi ,

Am also getting the same error. Can you please let me know how you fixed.

I placed the below in puppet master /etc/puppet/puppet.conf

[master]
  node_terminus = exec
  external_nodes = /usr/local/bin/snc_enc.py

Can you please help.

John Gelnaw

unread,
Oct 17, 2016, 11:43:44 AM10/17/16
to Puppet Users
Some things to keep in mind for successful ENC scripts...

First, on the agent, run:

# facter fqdn

This is the node name that will be reported to the puppet master (equivalent to 'hostname -f').  If it doesn't match expectations, fix that first-- preferably via DNS, but /etc/hosts is a valid solution if necessary.

Other thing(s) to make sure of with your ENC code:

  * don't output any text that isn't YAML
  * don't return any exit code other than 0, unless you want your puppet runs to halt on ENC error
  * Don't use tabs when generating your yaml.  ;)

That means any debug text needs to go to stderr (or a log file), and you need exception handlers for everything.

And in the "probably obvious" category, I construct one large data structure in memory containing all the output I want in my YAML, and then dump that structure via a YAML library, rather than trying to format the output myself.

jcbollinger

unread,
Oct 18, 2016, 11:02:05 AM10/18/16
to Puppet Users


On Monday, October 17, 2016 at 10:43:44 AM UTC-5, John Gelnaw wrote:
Some things to keep in mind for successful ENC scripts...

First, on the agent, run:

# facter fqdn

This is the node name that will be reported to the puppet master (equivalent to 'hostname -f').


... unless a different one is specified in the agent's configuration.  If the machines' hostnames change over time -- for example, if they get their hostnames via DHCP -- then configuring invariant machine-specific node names might solve the problem.


John

Reply all
Reply to author
Forward
0 new messages