Storage/XRootD: Handle storage checksums

This commit is contained in:
Adrian Moennich 2017-08-29 09:46:20 +02:00
parent 92c8a6c0fb
commit 7f89fedd9f
2 changed files with 7 additions and 8 deletions

View File

@ -97,14 +97,13 @@ class XRootDStorage(Storage):
if not fs.exists(basedir):
fs.makedir(basedir, recursive=True, allow_recreate=True)
with fs.open(filepath, 'wb') as f:
shutil.copyfileobj(fileobj, f, 1024 * 1024)
return name
checksum = self._copy_file(fileobj, f)
return name, checksum
def save(self, name, content_type, filename, fileobj):
try:
fs = self._get_xrootd_fs()
name = self._save(name, fileobj, fs)
return name
return self._save(name, fileobj, fs)
except Exception as e:
raise StorageError('Could not save "{}": {}'.format(name, e)), None, sys.exc_info()[2]
@ -158,7 +157,6 @@ class EOSStorage(XRootDStorage):
# object which does not have seek/tell methods.
size_hint = current_app.config['MAX_CONTENT_LENGTH'] if current_app else None
fs = self._get_xrootd_fs(size=size_hint)
name = self._save(name, fileobj, fs)
return name
return self._save(name, fileobj, fs)
except Exception as e:
raise StorageError('Could not save "{}": {}'.format(name, e)), None, sys.exc_info()[2]

View File

@ -18,9 +18,10 @@ from __future__ import unicode_literals
from setuptools import setup
setup(
name='indico_storage_xrootd',
version='0.1.1',
version='0.1.2',
url='https://github.com/indico/indico-plugins',
license='https://www.gnu.org/licenses/gpl-3.0.txt',
author='Indico Team',
@ -29,7 +30,7 @@ setup(
zip_safe=False,
platforms='any',
install_requires=[
'indico>=1.9.10',
'indico>=1.9.11.dev16',
'xrootdpyfs==0.1.5',
],
classifiers=[