Upload images to swift as application/octet-stream
To be fair, this should have been pretty obvious when we wrote it. Of course glance images are application/octet-stream. Also, update the comment about the swift bug, since it's not a swift bug - it's doing exactly what we told it to do. Change-Id: Id992ef12e017d84a01249555518c86fb20280053
This commit is contained in:
parent
14c371e944
commit
48e7eb06cd
@ -95,12 +95,6 @@ class ShadeAdapter(adapter.Adapter):
|
|||||||
'text/plain',
|
'text/plain',
|
||||||
'application/octet-stream'):
|
'application/octet-stream'):
|
||||||
return response
|
return response
|
||||||
elif response.headers.get('X-Static-Large-Object'):
|
|
||||||
# Workaround what seems to be a bug in swift where SLO objects
|
|
||||||
# return Content-Type application/json but contain
|
|
||||||
# application/octet-stream
|
|
||||||
# Bug filed: https://bugs.launchpad.net/swift/+bug/1658295
|
|
||||||
return response
|
|
||||||
else:
|
else:
|
||||||
if not response.content:
|
if not response.content:
|
||||||
# This doens't have any content
|
# This doens't have any content
|
||||||
|
@ -14,6 +14,7 @@ import collections
|
|||||||
import functools
|
import functools
|
||||||
import hashlib
|
import hashlib
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
import json
|
||||||
import jsonpatch
|
import jsonpatch
|
||||||
import operator
|
import operator
|
||||||
import os
|
import os
|
||||||
@ -3516,7 +3517,8 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
|
|
||||||
self.create_object(
|
self.create_object(
|
||||||
container, name, filename,
|
container, name, filename,
|
||||||
md5=md5, sha256=sha256)
|
md5=md5, sha256=sha256,
|
||||||
|
**{'content-type': 'application/octet-stream'})
|
||||||
if not current_image:
|
if not current_image:
|
||||||
current_image = self.get_image(name)
|
current_image = self.get_image(name)
|
||||||
# TODO(mordred): Can we do something similar to what nodepool does
|
# TODO(mordred): Can we do something similar to what nodepool does
|
||||||
@ -5972,7 +5974,7 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
return self._object_store_client.put(
|
return self._object_store_client.put(
|
||||||
endpoint,
|
endpoint,
|
||||||
params={'multipart-manifest': 'put'},
|
params={'multipart-manifest': 'put'},
|
||||||
headers=headers, json=manifest)
|
headers=headers, data=json.dumps(manifest))
|
||||||
|
|
||||||
def _finish_large_object_dlo(self, endpoint, headers):
|
def _finish_large_object_dlo(self, endpoint, headers):
|
||||||
headers = headers.copy()
|
headers = headers.copy()
|
||||||
|
Loading…
Reference in New Issue
Block a user