When POSTing to a Chef REST endpoint, you want to NOT include the
resource name. So, the full URL you POST to will be:
Using Chef::REST, this is:
If it fits your usage scenario, you might want to investigate creating
Chef::Node objects and then using the Node#save method which takes
care of all of this for you.
On Thu, Feb 18, 2010 at 10:41 AM, Matthias Splieth firstname.lastname@example.org wrote:
Also, I tried “name = node[:fqdn].chomp.gsub(”.","_")" and
"chef.post_rest(’/nodes/’ + name , node)", but I still get a 404…
Thom May wrote:
I think you want to to post_rest to ‘/nodes/’, since you’re creating a
new node. If you’re saving an existing node,
you should put_rest to ‘/nodes/hostname_domain_tld’ (ie, gsub(".","_") on
On Thu, Feb 18, 2010 at 17:15, Kristin Thomsen email@example.com
thanks for that! I didn’t know that run_list can deal with strings
Now I got one problem left: when I try to make a POST to the server, I
a 404-Error and I don’t know why.
I’m doing a
rest.post_rest(‘http://localhost:4000/nodes/’ + node.name, node)
Any idea why this happens?
you don’t need a chef::recipe - run_list is an array of strings:
On Thu, Feb 18, 2010 at 15:50, firstname.lastname@example.org wrote:
I want to get all available recipes and apply them to a node. How can I
that? I tried it by loading a cookbook and accessing the recipes of
cookbook. But it seems I can only recieve a recipes name by doing so -
need a Chef::Recipe for doing node.run_list << a_recipe!
PS: i’m using chef 0.7.16