Is it possible to set ACL to container when uploading to Swift?

asked 2016-12-29 01:32:06 -0500

I want to use Python-Swift to upload a file to a non-exists container. Is it possible to set ACL to the automatically created container? At the moment I have to call create container separately in order to do it.

I also find it rather wasteful that SwiftUploadObject try to create already existing container on every upload request.

edit retag flag offensive close merge delete

Comments

The openstack client doesn't automatically create the container and, afaik, doesn't check for its existence. I don't think you can set an ACL at the same time you create a container - first create the container, then set the ACL.

Bernd Bausch gravatar imageBernd Bausch ( 2016-12-29 03:47:03 -0500 )edit

First of all, it is possible to set ACL when creating container.

self.service = SwiftService(options=auth_options)
self.acl = {'read_acl': '.r:*'}
self.service.post(container_name, None, self.acl)

RobGThai gravatar imageRobGThai ( 2016-12-29 04:21:27 -0500 )edit

Also, if I upload to a non-existing container, said container get created automatically but without proper ACL.

It might be python specific tho but I'm sure it does because the upload result always get create_container action back when I upload a file.

RobGThai gravatar imageRobGThai ( 2016-12-29 04:23:19 -0500 )edit