Failed to find [host] via exec

90 views
Skip to first unread message

Taylor Leese

unread,
Jul 12, 2014, 7:38:57 AM7/12/14
to puppet...@googlegroups.com
Hi all,

I'm trying to setup an external node classifier and I'm running into an error that I haven't been able to resolve.

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed when searching for node puppet.myhost.com: Failed to find puppet.myhost.com via exec: Execution of '/etc/puppet/bin/node_classifier puppet.myhost.com' returned 1: 

This is the relevant part of my puppet.conf:

node_terminus = exec
external_nodes = /etc/puppet/bin/node_classifier

The interesting thing is that if I run the classifier manually I get what appears (to me) to be correct output. I'm using Puppet 3.4.3. Any idea what I might be doing wrong?

root@puppet:/etc/puppet# ./bin/node_classifier puppet.myhost.com

--- 

  classes: 

    - apt

    - common

    - ntp

    - puppet

    - sudo

    - users

  parameters: 

    puppetserver: puppet.myhost.com

  environment: production

root@puppet:/etc/puppet# 

- Taylor

José Luis Ledesma

unread,
Jul 12, 2014, 7:41:16 AM7/12/14
to puppet...@googlegroups.com

Have you tried to run the command with the same user the puppet master is running? (Usually puppet)

Regards,

--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d5056060-42ad-4807-8b47-7c9b204bc94e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Taylor Leese

unread,
Jul 12, 2014, 7:52:04 AM7/12/14
to puppet...@googlegroups.com
I probably also should have mentioned I am using Ubuntu 14 and this is running locally via Vagrant and the Vagrant agent provisioner. I've tried running the puppet agent manually after the Vagrant provisioning fails and I receive the same error message. 

Jose - When you say "the command" what do you mean? The node classifier? My VM doesn't have a puppet user so I checked to see what user the agent was running under and it is root.

root@nexus:/home/vagrant# ps -ef | grep puppet

root      1480     1  0 11:01 ?        00:00:01 /usr/bin/ruby /usr/bin/puppet agent

- Taylor

José Luis Ledesma

unread,
Jul 12, 2014, 7:54:22 AM7/12/14
to puppet...@googlegroups.com

The node classifier command is launched by the same user the runs puppet master, and normally it is the 'puppet' user.

You should try running the node classifier command in the puppet master with the same user it runs.

Regards

Taylor Leese

unread,
Jul 12, 2014, 8:06:22 AM7/12/14
to puppet...@googlegroups.com
Jose - Ah, the puppet master itself is running as the "puppet" user. 

root@puppet:/etc/puppet# ps -ef | grep puppet

root      1362     1  0 10:55 ?        00:00:02 /usr/bin/ruby /usr/bin/puppet agent

puppet   20719     1  0 11:31 ?        00:00:00 Passenger RackApp: /usr/share/puppet/rack/puppetmasterd


I tried the following and got an error:

root@puppet:/etc/puppet# sudo -u puppet ./bin/node_classifier 

/usr/lib/ruby/vendor_ruby/facter/util/directory_loader.rb:75:in `open': Permission denied - /root/.facter/facts.d (Errno::EACCES)

I'm not sure if this is really indicative of the actual problem or not. 

- Taylor

Taylor Leese

unread,
Jul 12, 2014, 8:23:19 PM7/12/14
to puppet...@googlegroups.com
It's also worth mentioning that even if I chown and chgrp /root/.facter/facts.d to puppet I still receive the same error. That also doesn't seem like it should be the solution. I found two Puppet issues that may be related, but it's not entirely clear if they are exactly the same.

Taylor Leese

unread,
Jul 13, 2014, 11:47:26 AM7/13/14
to puppet...@googlegroups.com
The work around I went with is to just avoid the "require 'puppet'" line in my external node classifier so I can avoid this issue completely. I just ignore the first line of the YAML file in /var/lib/puppet/yaml/facts/ and do YAML.load rather than YAML.load_file.

- Taylor

jcbollinger

unread,
Jul 14, 2014, 9:48:56 AM7/14/14
to puppet...@googlegroups.com


On Sunday, July 13, 2014 10:47:26 AM UTC-5, Taylor Leese wrote:
The work around I went with is to just avoid the "require 'puppet'" line in my external node classifier so I can avoid this issue completely. I just ignore the first line of the YAML file in /var/lib/puppet/yaml/facts/ and do YAML.load rather than YAML.load_file.


I'm glad you found a solution.  It's not clear to me why "require 'puppet'" would cause your ENC to fail, but one possibility would be that your Puppet install is not in the default Ruby load path.  That seems especially likely if the behavior can be toggled just by the 'require', without actually using anything thereby loaded.  On the other hand, I'm inclined to think that your ENC probably should avoid requiring Puppet if it reasonably can do, so I wouldn't change anything from what you have now.


John

Reply all
Reply to author
Forward
0 new messages