Skip to content

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

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 (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line358, inget_entitiesself._ensure_loaded()
File"/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line192, in_ensure_loadedself.reload()
File"/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line409, inreloadforentryinfound['items']:
KeyError: 'items'>>>acl.get_entities()
[]
>>>acl.reload()
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line409, inreloadforentryinfound['items']:
KeyError: 'items'>>>acl.save()
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/user/.local/lib/python2.7/site-packages/gcloud/storage/acl.py", line453, insaveforentryinresult[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