From ba6bd10511cd5ae0c759e3ede99b45115d53d43c Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Thu, 4 May 2017 18:17:51 +0200 Subject: [PATCH] Storage/XRootD: Support sending file via FUSE Like this the webserver can deal with the file instead of sending possibly large amounts of data though Indico itself. --- storage_xrootd/indico_storage_xrootd.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/storage_xrootd/indico_storage_xrootd.py b/storage_xrootd/indico_storage_xrootd.py index 4edd778af..8873a417a 100644 --- a/storage_xrootd/indico_storage_xrootd.py +++ b/storage_xrootd/indico_storage_xrootd.py @@ -16,6 +16,7 @@ from __future__ import unicode_literals +import ast import os import shutil import sys @@ -46,10 +47,13 @@ def _get_storage_backends(self, sender, **kwargs): class XRootDStorage(Storage): name = 'xrootd' - simple_data = True + simple_data = False def __init__(self, data): - self.xrootd_host, self.path = data.split(':', 1) + data = self._parse_data(data) + self.xrootd_host = data['host'] + self.path = data['root'] + self.fuse = bool(ast.literal_eval(data.get('fuse', 'False').title())) @return_ascii def __repr__(self): @@ -105,4 +109,5 @@ def getsize(self, file_id): raise StorageError('Could not get size of "{}": {}'.format(file_id, e)), None, sys.exc_info()[2] def send_file(self, file_id, content_type, filename, inline=True): - return send_file(filename, self.open(file_id), content_type, inline=inline) + file_data = self._resolve_path(file_id) if self.fuse else self.open(file_id) + return send_file(filename, file_data, content_type, inline=inline)