예제 #1
0
 def update_store_acls(self, req, image_id, location_uri, public=False):
     if location_uri:
         try:
             read_tenants = []
             write_tenants = []
             members = registry.get_image_members(req.context, image_id)
             if members:
                 for member in members:
                     if member['can_share']:
                         write_tenants.append(member['member_id'])
                     else:
                         read_tenants.append(member['member_id'])
             store.set_acls(location_uri,
                            public=public,
                            read_tenants=read_tenants,
                            write_tenants=write_tenants,
                            context=req.context)
         except store.UnknownScheme:
             msg = _("Store for image_id not found: %s") % image_id
             raise webob.exc.HTTPBadRequest(explanation=msg,
                                            request=req,
                                            content_type='text/plain')
         except store.NotFound:
             msg = _("Data for image_id not found: %s") % image_id
             raise webob.exc.HTTPNotFound(explanation=msg,
                                          request=req,
                                          content_type='text/plain')
예제 #2
0
파일: controller.py 프로젝트: mahak/glance
 def update_store_acls(self, req, image_id, location_uri, public=False):
     if location_uri:
         try:
             read_tenants = []
             write_tenants = []
             members = registry.get_image_members(req.context, image_id)
             if members:
                 for member in members:
                     if member['can_share']:
                         write_tenants.append(member['member_id'])
                     else:
                         read_tenants.append(member['member_id'])
             store.set_acls(location_uri, public=public,
                            read_tenants=read_tenants,
                            write_tenants=write_tenants,
                            context=req.context)
         except store.UnknownScheme:
             msg = _("Store for image_id not found: %s") % image_id
             raise webob.exc.HTTPBadRequest(explanation=msg,
                                            request=req,
                                            content_type='text/plain')
         except store.NotFound:
             msg = _("Data for image_id not found: %s") % image_id
             raise webob.exc.HTTPNotFound(explanation=msg,
                                          request=req,
                                          content_type='text/plain')