- From: "Julian C. Dunn" <
>
- To: "
" <
>
- Subject: [chef] Re: Querying a Chef server through it's API
- Date: Fri, 23 Jan 2015 16:55:37 -0500
Couple things:
* You don't have a colon after 'http'
* If you're running Chef Server 12 or connecting to Hosted Enterprise
Chef, the chef_server_url is going to be something like
https://your-chef-server/organizations/yourorg -- there is no endpoint
'/nodes' at the root of the system.
- Julian
On Fri, Jan 23, 2015 at 12:48 PM, ANGELA EBIRIM
<
>
wrote:
>
Hello everyone,
>
>
I'm new to Chef so be gentle!
>
>
I'm trying to query a Chef server through it's API and have developed the
>
following code:-
>
>
require 'chef/config'
>
require 'chef/log'
>
require 'chef/rest'
>
chef_server_url = "http//chef.prod.practor.service"
>
client_name = "ace67"
>
signing_key_filename=File.dirname(__FILE__) + "/.chef/ace67.pem"
>
>
rest = Chef::REST.new(chef_server_url, client_name, signing_key_filename)
>
nodes = rest.get_rest("/nodes")
>
>
nodes.keys.each do |node_name|
>
puts "Node name: #{node_name}"
>
end
>
>
It's a simple Ruby script to query the Chef server. through it's API, for a
>
list of nodes. However when I run the script, I get an error of TypeError:
>
can't dup NilClass. It's occurring on the nodes = rest.get_rest("/nodes")
>
line.
>
>
I'm running Chef version 11.16.2
>
>
I'd appreciate any assistance with this.
>
>
Many thanks
>
>
Angela Ebirim
>
>
Sent from iCloud
--
[ Julian C. Dunn
<
>
* Sorry, I'm ]
[ WWW:
http://www.aquezada.com/staff/julian * only Web 1.0 ]
[
gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]
Archive powered by MHonArc 2.6.16.