Need default attribute list of a cookbook using api

Hi,

Is there a way to get the default cookbook attributes using chef-api . So that
i can override them pragmatically later on .

I used knife to fetch cookbook metadata in json format , but that only list
the attribute file.

“attributes”: [
{
“name”: “default.rb”,
“path”: “attributes/default.rb”,
“checksum”: “f9cc6b7d7075cf91e012e00e0f4ff796”,
“specificity”: “default”,
“url”: “https://—D”
}

thanks
jagadeesh

On Thursday, September 5, 2013 at 12:19 AM, jagadeesh@collab.net wrote:

Hi,

Is there a way to get the default cookbook attributes using chef-api . So that
i can override them pragmatically later on .

I used knife to fetch cookbook metadata in json format , but that only list
the attribute file.

"attributes": [
{
"name": "default.rb",
"path": "attributes/default.rb",
"checksum": "f9cc6b7d7075cf91e012e00e0f4ff796",
"specificity": "default",
"url": "https://---D"
}

thanks
jagadeesh

This isn't really possible. If the metadata file correctly documents the attributes, you can get that from the API, but there's no guarantee that this information is complete or up-to-date. The source of truth is the attributes file, which is ruby code. If the cookbooks you're interested in are simple enough, you could maybe hack something together to fetch the attributes files and figure out the attributes that way.

--
Daniel DeLeo