Jira (PUP-10948) puppet node find <node_name> does not honour node_name

4 views
Skip to first unread message

Kaushal Kumar (Jira)

unread,
Mar 4, 2021, 8:18:03 AM3/4/21
to puppe...@googlegroups.com
Kaushal Kumar created an issue
 
Puppet / Bug PUP-10948
puppet node find <node_name> does not honour node_name
Issue Type: Bug Bug
Affects Versions: PUP 6.20.0
Assignee: Unassigned
Created: 2021/03/04 5:17 AM
Priority: Normal Normal
Reporter: Kaushal Kumar

Puppet Version: 6.20
Puppet Server Version: 6.15.1
OS Name/Version: CentOS Linux version 8

I am using puppet v6.20.0 and am executing sudo puppet node find <node_name> to get the information of a node from puppet master. This command returns a node information even if an invalid node name (or node name which does not exists) is provided to this command.

Is there any other argument which has to be provided to this.

Desired Behavior: node find must not provide information about unknown nodes

Actual Behavior: node find returns the node information irrespective of host name.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Mar 4, 2021, 3:08:03 PM3/4/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10948
 
Re: puppet node find <node_name> does not honour node_name

puppet node find will only tell you about the current node you're running on. When you enter an invalid node, the command assumes you mean the current node is named that. So it combines the current nodes facts with that name.

If you want to know if a node exists, then you're probably better off querying for the cert for that node:

# curl -kf https://<server>:8140/puppet-ca/v1/certificate/doesntexist
curl: (22) The requested URL returned error: 404 Not Found
# echo $?
22

Note puppetserver's default auth.conf doesn't allow HEAD requests, so you might want to change that.

Or query for the node in puppetdb: https://puppet.com/docs/puppetdb/latest/api/query/v4/nodes.html#pdbqueryv4nodes

Kaushal Kumar (Jira)

unread,
Mar 4, 2021, 11:53:02 PM3/4/21
to puppe...@googlegroups.com

Hi Josh Cooper ,

Thanks for your response.

I was trying to get the environment associated to each node as there could be multiple environment available during installation. The docs @ https://puppet.com/docs/puppet/6.21/environments_about.html states 

 

To look up which environment a node is in, run puppet node find <node> on the Puppet Server host node, replacing <node> with the node's exact name.
Alternatively, run puppet node find <node> --render_as json | jq .environment to render the output as JSON and return only the environment name

Even the help of this command this does not indicates what you have described above. So there are couple of questions
1. Can we get the documentation fixed in the environments_about.html and man page of this command.
2. What will be your suggestion to get the environment related to different nodes in puppet setup. What I could think was to connect to each node and query the node information via puppet node find, but that could involve connecting to several machines. Is there a better way to do this?

Josh Cooper (Jira)

unread,
Mar 9, 2021, 4:17:02 PM3/9/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10948

Kaushal Kumar The puppet node find will work if you run the command on the puppetserver and you enable puppetserver's node cache. It's disabled by default in puppet6. However, a better way to do this is to query puppetdb. If you have suggestions for documentation, please leave a comment at the bottom of the documentation page. For general questions like this, please reach out in puppet slack. In the meantime, I'm going to close this.

Reply all
Reply to author
Forward
0 new messages