Foreman 1.16.0 node classifier doesn't seem to work?

Problem:
Imported Windows host with callback function from ansible, then used ansible role to deploy puppet agent. I assigned one class to the host group, and also tried the host directly, however when running puppet agent -t, or every half-hour, I get the error: “Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find node statement with name ‘default’ or…”

Expected outcome:
After signing the certificate request, I expected assigned classes to be included when running puppet or on the normal interval.

Foreman and Proxy versions:
1.16.0

Foreman and Proxy plugin versions:
1.16.0

Additional Information
If I call “/etc/puppetlabs/puppet/node.rb [host]” where [host] is one of the FQDNs listed in the error message, I get YAML output with the expected classes and environments.

The only errors I really see are related to a 500 error when attempting to retrieve templates for the host - remember, this was created through a callback from ansible:

Also, the full error I mentioned is Could not fine node statement with name ‘default’ or ‘[host]’…on [host]

And despite this, apparently puppet agent is still communicating with the master, because it knows that I installed DSC and other Windows modules on the master and logs show it creating different files for chocolatey facts and DSC and such on the agent.

One thing I notice - the full error is: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find node statement with name ‘default’ or ‘[host fqdn], [hostname].[shortdomain], [hostname], [camelcasefqdn], [hostname].[camelcaseshortdomain]’ on node [host fqdn]

That is: Could not find node statement with name default or ‘a list’. Does that mean it’s trying to find the node statement for a node whose name is a tuple, instead of a node whose name matches the lowercase fqdn?

I tried manually specifying certname, but that didn’t work. Also, “puppet cert list -a” on the foreman server doesn’t show any of those alt names I mentioned as being associated with the agent certificate.

Figured it out!

Server was throwing 500 error due to the existence of /etc/puppetlabs/code/environments/production/manifests/site.pp. I had defined a node in there at one point to test something, and I guess the way catalogs are queried in the API means that if site.pp exists, it overrides whatever class definitions Foreman has.

1 Like

Glad you got it. This is documented by Puppet, but granted, it’s a bit hard to find :slight_smile: - see Note 1 here

https://puppet.com/docs/puppet/5.3/nodes_external.html#how-merging-works