jclouds / legacy-jclouds-cli

https://jclouds.apache.org
Apache License 2.0
17 stars 5 forks source link

Checking for container existence may return EACCES for non-existing containers #46

Closed timuralp closed 11 years ago

timuralp commented 11 years ago

I used valid AWS credentials against S3 and got the following results for different containers: $JCLOUDS_CLI/bin/jclouds blobstore container-exists --provider=aws-s3 --identity= --credential= timur-test File not found: Container does not exist: timur-test

$JCLOUDS_CLI/bin/jclouds blobstore container-exists --provider=aws-s3 --identity= --credential= cloud Authorization error: HEAD https://cloud.s3.amazonaws.com/?max-keys=0 HTTP/1.1 -> HTTP/1.1 403 Forbidden

I double checked and the cloud container does not exist in AWS. Using names such as "bucket" also results in the same error. However, cloud-test succeeds.

gaul commented 11 years ago

S3 container names are global and you should expect EACCES for containers which exist but that you do not own. For reference, here are tests from an existing container, a non-existing container, and a container owned by someone else:

$ bin/jclouds-cli-1.5.7_1/bin/jclouds blobstore container-exists gaultest
$ echo $?
0

$ bin/jclouds-cli-1.5.7_1/bin/jclouds blobstore container-exists gaultest2
File not found: Container does not exist: gaultest2
$ echo $?
2

$ bin/jclouds-cli-1.5.7_1/bin/jclouds blobstore container-exists cloud
Authorization error: HEAD https://cloud.s3.amazonaws.com/?max-keys=0 HTTP/1.1 -> HTTP/1.1 403 Forbidden
$ echo $?
13
timuralp commented 11 years ago

Ok, I completely misunderstood the scheme AWS uses. Thanks @andrewgaul for looking into this!