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]
- client response does not contain an 'admin' field or value
- client response contains an additional 'orgname' attribute
- client response contains an additional 'validator' attribute
- client response contains an additional field 'clientname' which is identical to 'name'
- 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\nhjUcCmsJAg
MBAAEwDQYJKoZIhvcNAQEFBQADgYEAOG2RQRTePGB3bTYfZB/+HXnx\nBuQexVfofaE3zh8iXBZA2Jl25iMAB6lkm7C6Ku7etviCytQCl6dLR6g3k1ApCy7y\nTZKUYn/TPTViC9FmyFq5s2TeJzusmN7LBEi094MoiGwpr92nuvh79SKQI4KXgqK0\n38zQYaVAylQPNfIe/7M=\n-----END CERTIFICATE-----\n"
}
Creating a client: POST /clients
- 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"
]
}
- 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