Skip to content

storage: some acl methods fail on empty (private) acl #652

@pdknsk

Description

@pdknsk

Easiest to set this up with gsutil. Please notice the verbose message.

$ gsutil defacl set private gs://bucket
Setting default object ACL on gs://bucket/...
$ gsutil defacl get gs://bucket
No default object ACL present for gs://bucket. This could occur if the default object ACL is private, in which case objects created in this bucket will be readable only by their creators.
[]

In particular acl.reload and acl.save don't work, probably others too.

>>> acl = storage.acl.DefaultObjectACL(bucket)
>>> acl.get_entities()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line 358, in get_entities
    self._ensure_loaded()
  File "/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line 192, in _ensure_loaded
    self.reload()
  File "/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line 409, in reload
    for entry in found['items']:
KeyError: 'items'
>>> acl.get_entities()
[]
>>> acl.reload()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line 409, in reload
    for entry in found['items']:
KeyError: 'items'
>>> acl.save()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line 453, in save
    for entry in result[self._URL_PATH_ELEM]:
KeyError: 'defaultObjectAcl'

This works fine if the default ACL is set to project-private rather than private.

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions