Merge pull request #3373 from quay/remove-head-check

Remove the HEAD check for a file being read in cloud storage
This commit is contained in:
Joseph Schorr 2019-02-18 14:59:36 -05:00 committed by GitHub
commit bcbcb1e197
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,9 +114,15 @@ class _CloudStorage(BaseStorageV2):
self._initialize_cloud_conn() self._initialize_cloud_conn()
path = self._init_path(path) path = self._init_path(path)
key = self._key_class(self._cloud_bucket, path) key = self._key_class(self._cloud_bucket, path)
if not key.exists(): try:
raise IOError('No such key: \'{0}\''.format(path)) return key.get_contents_as_string()
return key.get_contents_as_string() except S3ResponseError as s3r:
# Raise an IOError in case the key was not found, to maintain the current
# interface.
if s3r.error_code == 'NoSuchKey':
raise IOError('No such key: \'{0}\''.format(path))
raise
def put_content(self, path, content): def put_content(self, path, content):
self._initialize_cloud_conn() self._initialize_cloud_conn()