- From: Seth Falcon <
>
- To:
- Subject: [chef] Re: Re: Re: Hosted Chef API - client resource discrepancies
- Date: Tue, 14 Aug 2012 21:09:27 -0700
Hi Jamie,
On Tue, Aug 14, 2012 at 8:33 PM, Jamie Winsor
<
>
wrote:
>
Here is the request response output from attempting to create a new client
>
with this body (note, I have removed the authorization headers):
>
>
Request
>
>
[2012-08-14T20:29:41-07:00] DEBUG: {:method=>:post,
>
:body=>"{\"chef_type\":\"client\",\"json_class\":\"Chef::ApiClient\",\"name\":\"ridley_test\",\"admin\":false}",
>
:url=>#<Addressable::URI:0x3fee1e828b8c
>
URI:https://api.opscode.com:443/organizations/vialstudios/clients>,
>
"Accept"=>"application/json", "Content-Type"=>"application/json",
>
"X-Chef-Version"=>"10.12.0", "Content-Length"=>"93"}
Hmm, I tried the following just now using shef and received a new client:
api.post("clients", {:name => "client-902", :admin => false})
The difference is the json_class key. Here's what happens if I add one:
api.post("clients", {:name => "client-904", :admin => false,
:json_class => "Chef::ApiClient"})
[2012-08-14T21:04:36-07:00] INFO: HTTP Request Returned 400 Bad
Request: , Clientname must not be blank, Clientname has an invalid
format
Net::HTTPServerException: 400 "Bad Request"
That is one rather unfortunate error message.
In OHC, clients are not represented by the Chef::ApiClient class and
this is likely part of the issue. Note that GET /clients/:client in
OHC returns a JSON object with no json_class, so at least there is
some consistency there.
Does this help you?
+ seth
--
Seth Falcon | Development Lead | Opscode | @sfalcon
Archive powered by MHonArc 2.6.16.