I need to fetch an attribute file from the chef service…
Using the REST API, I call
GET /organizations/NAME/cookbooks/NAME/VERSION
And among other things I get:
{
“name”:“versions.rb”,
“path”:“attributes/versions.rb”,
“url”:“https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D”,
“checksum”:“bec47221813e48f656813339fbf57677”,
“specificity”:“default”
}
I tried to fetch the file using the url given (either directly, or using
the same signature schema as other REST api calls), but it doesn’t work,
I get a 403.
What is the meaning of the URL if it’s not to fetch the file? How do I
fetch the file? Is there a different REST api call that will give me the
file directly (since I know everything else about it)
Thanks,
Roberto Leibman
On Oct 8, 2015, at 1:59 PM, Roberto Leibman roberto@leibman.net wrote:
I need to fetch an attribute file from the chef service...
Using the REST API, I call
GET /organizations/NAME/cookbooks/NAME/VERSION
And among other things I get:
{
"name":"versions.rb",
"path":"attributes/versions.rb",
"url":"https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D",
"checksum":"bec47221813e48f656813339fbf57677",
"specificity":"default"
}
I tried to fetch the file using the url given (either directly, or using the same signature schema as other REST api calls), but it doesn't work, I get a 403.
What is the meaning of the URL if it's not to fetch the file? How do I fetch the file? Is there a different REST api call that will give me the file directly (since I know everything else about it)
What are you trying to do? Attempting to manually re-implement cookbook downloads seems like a bad idea. Can you illustrate your use case?
--Noah
On 10/08/2015 12:27 PM, Noah Kantrowitz wrote:
On Oct 8, 2015, at 1:59 PM, Roberto Leibman roberto@leibman.net wrote:
I need to fetch an attribute file from the chef service...
Using the REST API, I call
GET /organizations/NAME/cookbooks/NAME/VERSION
And among other things I get:
{
"name":"versions.rb",
"path":"attributes/versions.rb",
"url":"https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D",
"checksum":"bec47221813e48f656813339fbf57677",
"specificity":"default"
}
I tried to fetch the file using the url given (either directly, or using the same signature schema as other REST api calls), but it doesn't work, I get a 403.
What is the meaning of the URL if it's not to fetch the file? How do I fetch the file? Is there a different REST api call that will give me the file directly (since I know everything else about it)
What are you trying to do? Attempting to manually re-implement cookbook downloads seems like a bad idea. Can you illustrate your use case?
--Noah
Excelent question. I need to provide some limited functionality to some
users that's similar to the chef web ui, in particular, I need to be
able to display a file that's calculated (i.e. not in source control
anywhere else)... the file itself is a calculation of all the npm
packages that are "latest" when my cookbook is "cooked" into chef-client.
Why do you think that seems like a bad idea?
On Thursday, October 8, 2015 at 10:59 AM, Roberto Leibman wrote:
I need to fetch an attribute file from the chef service...
Using the REST API, I call
GET /organizations/NAME/cookbooks/NAME/VERSION
And among other things I get:
{
"name":"versions.rb",
"path":"attributes/versions.rb",
"url":"https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D" (https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D),
"checksum":"bec47221813e48f656813339fbf57677",
"specificity":"default"
}
I tried to fetch the file using the url given (either directly, or using the same signature schema as other REST api calls), but it doesn't work, I get a 403.
FYI that URL expires after a certain time (see Expires=1444350260 in the URL). I think by default it’s valid for an hour. Anyway, you need to make the GET to the cookbooks API each time and extract the URL.
Alternatively, I suppose you could find the access key and talk to the bookshelf service like s3, but that’s probably not a very good idea.
What is the meaning of the URL if it's not to fetch the file? How do I fetch the file? Is there a different REST api call that will give me the file directly (since I know everything else about it)
Thanks,
Roberto Leibman
--
Daniel DeLeo
On 10/08/2015 03:50 PM, Daniel DeLeo wrote:
On Thursday, October 8, 2015 at 10:59 AM, Roberto Leibman wrote:
I need to fetch an attribute file from the chef service...
Using the REST API, I call
GET /organizations/NAME/cookbooks/NAME/VERSION
And among other things I get:
{
"name":"versions.rb",
"path":"attributes/versions.rb",
"url":"https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D" (https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D),
"checksum":"bec47221813e48f656813339fbf57677",
"specificity":"default"
}
I tried to fetch the file using the url given (either directly, or using the same signature schema as other REST api calls), but it doesn't work, I get a 403.
FYI that URL expires after a certain time (see Expires=1444350260 in the URL). I think by default it’s valid for an hour. Anyway, you need to make the GET to the cookbooks API each time and extract the URL.
I tried getting it immediately and it didn't work. Am I supposed to pass
some credentials to it? Using the REST signature schema did not work.
Alternatively, I suppose you could find the access key and talk to the bookshelf service like s3, but that’s probably not a very good idea.
I'm running my own server, though it IS in aws, I'm not using s3 or
anything similar. Does my chef server think that I'm trying to get a
community recipe? the recipe resides in my server only.
What is the meaning of the URL if it's not to fetch the file? How do I fetch the file? Is there a different REST api call that will give me the file directly (since I know everything else about it)
Thanks,
Roberto Leibman
--
Daniel DeLeo
On Thursday, October 8, 2015 at 4:22 PM, Roberto Leibman wrote:
On 10/08/2015 03:50 PM, Daniel DeLeo wrote:
On Thursday, October 8, 2015 at 10:59 AM, Roberto Leibman wrote:
I need to fetch an attribute file from the chef service...
Using the REST API, I call
GET /organizations/NAME/cookbooks/NAME/VERSION
And among other things I get:
{
"name":"versions.rb",
"path":"attributes/versions.rb",
"url":"https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D" (https://myserver:443/bookshelf/organization-3217b9e79830f0fa8747107257d4e50e/checksum-bec47221813e48f656813335fbf57677?AWSAccessKeyId=1d77956dc74704cfa99edc19d2f93bb7909ae802&Expires=1444350260&Signature=kNVJhVbKdSdXI5aLW6X7zS/wHw%3D),
"checksum":"bec47221813e48f656813339fbf57677",
"specificity":"default"
}
I tried to fetch the file using the url given (either directly, or using the same signature schema as other REST api calls), but it doesn't work, I get a 403.
FYI that URL expires after a certain time (see Expires=1444350260 in the URL). I think by default it’s valid for an hour. Anyway, you need to make the GET to the cookbooks API each time and extract the URL.
I tried getting it immediately and it didn't work. Am I supposed to pass
some credentials to it? Using the REST signature schema did not work.
You shouldn’t need any signature at all. Not sure if signing the request would break anything though. You might try chef-server-ctl tail
to see if there’s any info in the logs.
Alternatively, I suppose you could find the access key and talk to the bookshelf service like s3, but that’s probably not a very good idea.
I'm running my own server, though it IS in aws, I'm not using s3 or
anything similar. Does my chef server think that I'm trying to get a
community recipe? the recipe resides in my server only.
The Bookshelf service is an S3 clone (supports enough of S3 for the erchef service to talk to it like S3). Hypothetically you could find the access key and talk to bookshelf with an S3 library, but this is probably a bad idea. Better to figure out why your request using the pre-signed URL isn’t working.
What is the meaning of the URL if it's not to fetch the file? How do I fetch the file? Is there a different REST api call that will give me the file directly (since I know everything else about it)
Thanks,
Roberto Leibman
--
Daniel DeLeo
--
Daniel DeLeo