- From: Seth Chisamore <
>
- To:
- Subject: [chef] Re: Hosted Chef API - client resource discrepancies
- Date: Tue, 14 Aug 2012 23:26:46 -0400
Jamie,
Try changing the 'clientname' attribute to a 'name' attribute.
The minimal client create body for OHC/OPC should be:
{"name":"ridley-test", "admin":false}
This should work across all flavors of Chef Server, as this is also the same
format used by the api client leveraged by chef-client:
https://github.com/opscode/chef/blob/master/chef/lib/chef/api_client.rb#L243
--
Seth Chisamore
Software Development Engineer, Opscode, Inc.
IRC, Skype, Twitter, Github: schisamo
On Aug 14, 2012, at 7:51 PM, Jamie Winsor
<
>
wrote:
>
Hey Noah,
>
>
Thanks for your quick response. I verified that I'm sending the 'orgname',
>
'validator', 'client name', and 'certificate' attributes with my request
>
and ditching the FOSS specific attributes but am still receiving the same
>
error. Have you tested the Python client lately against the current
>
installation of Hosted Chef?
>
>
Request Body
>
{\"chef_type\":\"client\",\"json_class\":\"Chef::ApiClient\",\"clientname\":\"ridley-test\",\"validator\":false,\"certificate\":null,\"orgname\":\"vialstudios\"}"
>
>
>
Response Body
>
"{\"error\":[null,\"Clientname must not be blank\",\"Clientname has an
>
invalid format\"]}"
>
>
--
>
Jamie Winsor
>
@resetexistence
>
https://github.com/reset
>
>
On Tuesday, August 14, 2012 at 2:59 PM, Noah Kantrowitz wrote:
>
>
> Check out https://github.com/coderanger/pychef/blob/master/chef/client.py.
>
> The implementation is a bit different between the FOSS server and the
>
> Hosted/Private server.
>
>
>
> --Noah
>
>
>
> On Aug 15, 2012, at 5:57 AM, Jamie Winsor wrote:
>
>
>
>> I'm working on a thread safe Chef API client with async capabilities for
>
>> dispatching parallel requests to a Chef Server. Through writing my
>
>> acceptance tests I've noticed that the client resource has a few
>
>> discrepancies with creation and retrieval of clients than what is
>
>> outlined in the official documentation:
>
>> http://wiki.opscode.com/display/chef/Server+API. It's worth noting that
>
>> this documentation reflects the behavior of the Open Source Server
>
>> correctly.
>
>>
>
>> Retrieving a client: GET /clients/[NAME]
>
>>
>
>> 1. client response does not contain an 'admin' field or value
>
>> 2. client response contains an additional 'orgname' attribute
>
>> 3. client response contains an additional 'validator' attribute
>
>> 4. client response contains an additional field 'clientname' which is
>
>> identical to 'name'
>
>> 5. client response contains an additional field 'certificate' which
>
>> appears to be a private key?
>
>>
>
>> See the raw response below:
>
>>
>
>> {
>
>> "orgname": "vialstudios",
>
>> "validator": false,
>
>> "clientname": "asdf",
>
>> "name": "asdf",
>
>> "certificate": "-----BEGIN
>
>> CERTIFICATE-----\\nMIIDOjCCAqOgAwIBAgIE85XemDANBgkqhkiG9w0BAQUFADCBnjELMAkGA1UEBhMC\\nVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxFjAUBgNV\\nBAoMDU9wc2NvZGUsIEluYy4xHDAaBgNVBAsME0NlcnRpZmljYXRlIFNlcnZpY2Ux\\nMjAwBgNVBAMMKW9wc2NvZGUuY29tL2VtYWlsQWRkcmVzcz1hdXRoQG9wc2NvZGUu\\nY29tMCAXDTEyMDgxNDE5NDQyN1oYDzIxMDEwODI0MTk0NDI3WjCBnTEQMA4GA1UE\\nBxMHU2VhdHRsZTETMBEGA1UECBMKV2FzaGluZ3RvbjELMAkGA1UEBhMCVVMxHDAa\\nBgNVBAsTE0NlcnRpZmljYXRlIFNlcnZpY2UxFjAUBgNVBAoTDU9wc2NvZGUsIElu\\nYy4xMTAvBgNVBAMUKFVSSTpodHRwOi8vb3BzY29kZS5jb20vR1VJRFMvY2xpZW50\\nX2d1aWQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzvS0Z+gVic+Rn\\ncxN/P3D1lDq0St+hAtp9U+4FgInjoSWZFP9LWKoWIebRxH8axZCX2eVGwOsK2Pju\\n8zmG78n1J41ymxSIJBGeL7QjDuAXdHA7YAlBbhslK74KGdEqOqpxghVJG6doJf3/\\nYBQYQD3tonkuoyG43M79288l9MhvjglhKY8C9MZcj9rLebuySuhANRuBrdtF2CEg\\nX5/zNSr2WKnOFurBXnaKEefSpkUEAFkqiMCxcWSG05de1TRkqXuWs+8lRwl8OLo7\\n4lCFNwQEbJwdoS/R/yHMOO1fy3UbyRBZXW3FkvyoD4vxZkMWcbZohPd0TAA4StI8\\nhjUcCmsJAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAOG2RQRTePGB3bTYfZB/+HXnx\\nBuQexVfofaE3zh8iXBZA2Jl25iMAB6lkm7C6Ku7etviCytQCl6dLR6g3k1ApCy7y\\nTZKUYn/TPTViC9FmyFq5s2TeJzusmN7LBEi094MoiGwpr92nuvh79SKQI4KXgqK0\\n38zQYaVAylQPNfIe/7M=\\n-----END
>
>> CERTIFICATE-----\\n"
>
>> }
>
>>
>
>> Creating a client: POST /clients
>
>> 1. creating a client with a JSON body containing a 'name' and 'admin'
>
>> field with a proper string and boolean value results in the error:
>
>>
>
>> 400 - Bad Request
>
>> {
>
>> "error": [
>
>> null,
>
>> "Clientname must not be blank",
>
>> "Clientname has an invalid format"
>
>> ]
>
>> }
>
>>
>
>> 2. even by specifying an additional 'clientname' field with a value the
>
>> same error is returned.
>
>>
>
>>
>
>> Are there any updated docs regarding the client creation API or dealing
>
>> with client permissions via the API in Private/Hosted Chef?
>
>>
>
>> --
>
>> Jamie Winsor
>
>> @resetexistence
>
>> https://github.com/reset
>
Archive powered by MHonArc 2.6.16.