Foreman / External Nodes -- Node Not found

1,417 views
Skip to first unread message

CraftyTech

unread,
Jul 22, 2010, 4:22:03 PM7/22/10
to Puppet Users
Hello All,

So I finally got around to start to cut over node definitions
from standard flat files to external nodes (foreman), and getting
error message: "Error 400 on SERVER: Could not find node 'nodename';
cannot compile" - So basically it can't pick up the node from the
external node config.

When I test the fetching of the yaml file it seems to work as I get a
result back: i.g:
curl -k https://foreman/node/nodename?format=yml

---
parameters:
puppetmaster: puppet
classes: []

environment: ""



##############################################################################################
This is my puppet.conf:


[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
reports= log,foreman,rrdgraph,store
clientyamldir = /var/lib/puppet/yaml/node
pluginsync = true
external_nodes = /etc/puppet/external_node.rb
node_terminus = exec

[puppetmasterd]
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
modulepath = $confdir/modules
templatedir = /etc/puppet/manifests/templates
#clientyamldir = /var/lib/puppet/yaml/node
reportdir = /var/lib/puppet/reports
storeconfigs = true
dbadapter = mysql
dbuser = app_puppet
dbpassword = xxxxxxxxxxxxxx
dbserver = localhost
dbsocket = /sql/mysql/mysql.sock
rrddir = /var/lib/puppet/rrd
rrdinterval = $runinterval
rrdgraph = true

[puppetd]
classfile = $vardir/classes.txt
report = true
localconfig = $vardir/localconfig

Any ideas?

Thanks,

Henry

Ohad Levy

unread,
Jul 23, 2010, 1:46:11 AM7/23/10
to puppet...@googlegroups.com
Hi,

The output you get from external nodes means that the host was not allocated to any class or puppet environment, make sure you edit the host details first in foreman.

Ohad


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


CraftyTech

unread,
Jul 23, 2010, 7:14:56 AM7/23/10
to Puppet Users
Thanks for the reply Ohad. Actually, that's part of the issue as
well; If I edit the host via Foreman web interface, I can't no longer
see it from "curl -k https://foreman/node/nodename?format=yml"; I'd
get message "404 Not Found" from the command line. On the flip side,
I'd have two nodes of the same name listed in Foreman web interface;
1) A new one that get's created when I run puppetd -t, and 2) The one
that I edited via the web interface.... I know it sounds confusing,
but that's exactly what's happening... It seems that the foreman
environment, and puppet environment see two different nodes, even
thought there's only one host.yaml file..

On Jul 23, 1:46 am, Ohad Levy <ohadl...@gmail.com> wrote:
> Hi,
>
> The output you get from external nodes means that the host was not allocated
> to any class or puppet environment, make sure you edit the host details
> first in foreman.
>
> Ohad
>
>
>
> On Fri, Jul 23, 2010 at 4:22 AM, CraftyTech <hmmed...@gmail.com> wrote:
> > Hello All,
>
> >     So I finally got around to start to cut over node definitions
> > from standard flat files to external nodes (foreman), and getting
> > error message: "Error 400 on SERVER: Could not find node 'nodename';
> > cannot compile" - So basically it can't pick up the node from the
> > external node config.
>
> > When I test the fetching of the yaml file it seems to work as I get a
> > result back: i.g:
> > curl  -khttps://foreman/node/nodename?format=yml
> > puppet-users...@googlegroups.com<puppet-users%2Bunsubscribe@google groups.com>
> > .

CraftyTech

unread,
Jul 23, 2010, 7:57:56 AM7/23/10
to Puppet Users
Small correction: "if I edit the host via Foreman web interface, I
can't no longer
see it from "curl -k https://foreman/node/nodename?format=yml"; I'd
get message "404 Not Found" from the command line" --> I'd have to re-
run puppetd -t, to be able to get a result from "curl -k
https://foreman/node/nodename?format=yml" again.. after that --> I'd
have two nodes of the same name listed in Foreman web interface..



On Jul 23, 7:14 am, CraftyTech <hmmed...@gmail.com> wrote:
> Thanks for the reply Ohad.  Actually, that's part of the issue as
> well; If I edit the host via Foreman web interface, I can't no longer
> see it from "curl  -khttps://foreman/node/nodename?format=yml"; I'd

CraftyTech

unread,
Jul 23, 2010, 11:53:50 AM7/23/10
to Puppet Users
Now I'm getting some results (Some progress finally !!):

---
parameters:
puppetmaster: puppet
domainname: dev.xxxxx.com
classes:
- basic
environment: puppetmasterd

But I still get: "server: Error 400 on SERVER: Could not find node
'nodename'". Does this mean that I have define a default node and
include it in the site.pp? From the forums I see mixed reviews; some
saying what with external nodes you need a default node definition,
and others saying that you don't need any node definition and that
everything should rely on the external node classifier.. any thoughts
or suggestions?

Thanks,



On Jul 23, 7:57 am, CraftyTech <hmmed...@gmail.com> wrote:
> Small correction: "if I edit the host via Foreman web interface, I
> can't no longer
> see it from "curl  -khttps://foreman/node/nodename?format=yml"; I'd
> get message "404 Not Found" from the command line" --> I'd have to re-
> run puppetd -t, to be able to get a result from "curl  -khttps://foreman/node/nodename?format=yml" again.. after that --> I'd

Ohad Levy

unread,
Jul 24, 2010, 2:14:02 AM7/24/10
to puppet...@googlegroups.com
Hi,

Foreman returns 404 if a node is not found, if you want puppet do to something for undefined nodes, you would need to create a default node statement.

what was your original problem? hostnames were not in fqdn?

Ohad

To unsubscribe from this group, send email to puppet-users...@googlegroups.com.

CraftyTech

unread,
Jul 26, 2010, 8:50:40 AM7/26/10
to Puppet Users
It was an issue with the FQDN value. Since it was a VM that was
testing, I had the hostname value on /etc/sysconfig/network set to
hostname only, as opposed to FQDN. Once I took care of that and value
took in, then I could query the node via classifier/fqdn.

On Jul 24, 2:14 am, Ohad Levy <ohadl...@gmail.com> wrote:
> Hi,
>

CraftyTech

unread,
Jul 27, 2010, 11:13:41 AM7/27/10
to Puppet Users
So this is where I'm at now:

Step 3)
From Server:
RAILS_ENV=production rake db:migrate; RAILS_ENV=production rake
puppet:import:hosts_and_facts; rake puppet:import:puppet_classes --
trace RAILS_ENV=production

from client's command line:
Step 2)
curl -k https://server/node/client.dev.domain.com?format=yml
---
parameters:
puppetmaster: puppet
domainname: dev.domain.com
classes:
- basic
environment: production

Step 3)

puppetd -t
notice: Ignoring --listen on onetime run
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find node 'client.dev.domain.com'; cannot compile
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

The crazy thing is that with webrick, I just point the node classifier
to server:port and it works just fine. The issue is the passenger/
apache config, which yields a result when queried via curl command..
so I'm at a lost here... can anyone think of a way to trace the apache/
passenger interaction to see where it dies out? right now I have the
foreman_url pointed to "https://server" ( I also tried https://server:443
and http://server:443).

If you guys have a working Apache/Passenger with Foreman working, do
you mind sharing your vhost.conf?

Thanks,

CraftyTech

unread,
Jul 27, 2010, 1:43:10 PM7/27/10
to Puppet Users
Update:
It looks like the culprit is the external node classifier: This
is the error from the server:

err: Could not find node 'client.dev.domain.com'; cannot compile
err: Failed to find client.dev.domain.com via exec: Execution of '/etc/
puppet/external_node.rb client.dev.domain.com' returned 1: /usr/lib/
ruby/1.8/net/http.rb:2022:in `read_status_line': wrong status line: "<!
DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN
\">" (Net::HTTPBadResponse)
from /usr/lib/ruby/1.8/net/http.rb:2009:in `read_new'
from /usr/lib/ruby/1.8/net/http.rb:1050:in `request'
from /etc/puppet/external_node.rb:14
from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /usr/lib/ruby/1.8/net/http.rb:440:in `start'
from /etc/puppet/external_node.rb:13

err: Could not find node 'client.dev.domain.com'; cannot compile


This is the Node Classifier:
#!/bin/ruby
# a simple script which fetches external nodes from Foreman
# you can basically use anything that knows how to get http data, e.g.
wget/curl etc.

# Foreman url
foreman_url="http://server:443"

require 'net/http'

foreman_url += "/node/#{ARGV[0]}?format=yml"
url = URI.parse(foreman_url)
req = Net::HTTP::Get.new(foreman_url)
res = Net::HTTP.start(url.host, url.port) { |http|
http.request(req)
}

case res
when Net::HTTPOK
puts res.body
else
$stderr.puts "Error retrieving node %s: %s" % [ARGV[0], res.class]



What node classifier do you guys use with Apache/Passenger config?

Thanks,


On Jul 27, 11:13 am, CraftyTech <hmmed...@gmail.com> wrote:
> So this is where I'm at now:
>
> Step 3)
> From Server:
> RAILS_ENV=production rake db:migrate; RAILS_ENV=production rake
> puppet:import:hosts_and_facts; rake puppet:import:puppet_classes --
> trace RAILS_ENV=production
>
> from client's command line:
> Step 2)
> curl  -khttps://server/node/client.dev.domain.com?format=yml
> ---
> parameters:
>   puppetmaster: puppet
>   domainname: dev.domain.com
> classes:
> - basic
> environment: production
>
> Step 3)
>
> puppetd -t
> notice: Ignoring --listen on onetime run
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Could not find node 'client.dev.domain.com'; cannot compile
> warning: Not using cache on failed catalog
> err: Could not retrieve catalog; skipping run
>
> The crazy thing is that with webrick, I just point the node classifier
> to server:port and it works just fine.  The issue is the passenger/
> apache config, which yields a result when queried via curl command..
> so I'm at a lost here... can anyone think of a way to trace the apache/
> passenger interaction to see where it dies out?  right now I have the
> foreman_url pointed to "https://server" ( I also triedhttps://server:443
> andhttp://server:443).
Reply all
Reply to author
Forward
0 new messages