Fix CORS in rackspace in upload-logs-swift

The CDN setup that rackspace has requires that the
Access-Control-Allow-Origin header be added to each object uploaded.

Change-Id: I0f6af613e2ebcf9cfe835dc8018a73922f9f0ed5
This commit is contained in:
James E. Blair 2019-08-02 13:38:26 -07:00
parent 41d06378b0
commit 4a1ecf50a5
1 changed files with 6 additions and 1 deletions

View File

@ -497,10 +497,13 @@ class Uploader():
# The ceph radosgw swift implementation requires an
# index.html at the root in order for any other indexes to
# work.
index_headers = {'access-control-allow-origin': '*'}
self.cloud.create_object(self.container,
name='index.html',
data='',
content_type='text/html')
content_type='text/html',
**index_headers)
# Enable the CDN in rax
if cdn_url:
self.cloud.session.put(cdn_url)
@ -574,6 +577,8 @@ class Uploader():
if self.delete_after:
headers['x-delete-after'] = str(self.delete_after)
headers['content-type'] = file_detail.mimetype
# This is required for Rackspace CDN
headers['access-control-allow-origin'] = '*'
for attempt in range(1, POST_ATTEMPTS + 1):
try: