Repository: rucio/rucio

Issue:
Conveyor should only use schemes compatible to the destination scheme
_Migrated from JIRA [RUCIO-2817](https://its.cern.ch/jira/browse/RUCIO-2817)_


Discussion:

Resolving patch:
diff --git a/lib/rucio/daemons/tracer/kronos.py b/lib/rucio/daemons/tracer/kronos.py
--- a/lib/rucio/daemons/tracer/kronos.py
+++ b/lib/rucio/daemons/tracer/kronos.py
@@ -6,7 +6,7 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 #
 # Authors:
-# - Thomas Beermann, <thomas.beermann@cern.ch>, 2014-2017
+# - Thomas Beermann, <thomas.beermann@cern.ch>, 2014-2018
 # - Vincent Garonne, <vincent.garonne@cern.ch>, 2015
 # - Mario Lassnig, <mario.lassnig@cern.ch>, 2015
 
@@ -297,7 +297,7 @@ def kronos_file(once=False, thread=0, brokers_resolved=None, dataset_queue=None)
         except:
             pass
 
-    die(executable='rucio-file', hostname=hostname, pid=pid, thread=thread)
+    die(executable='kronos-file', hostname=hostname, pid=pid, thread=thread)
     logging.info('(kronos_file) graceful stop done')
 
 
@@ -310,6 +310,7 @@ def kronos_dataset(once=False, thread=0, dataset_queue=None):
 
     dataset_wait = config_get_int('tracer-kronos', 'dataset_wait')
     start = datetime.now()
+    sanity_check(executable='kronos-dataset', hostname=hostname)
     while not graceful_stop.is_set():
         live(executable='kronos-dataset', hostname=hostname, pid=pid, thread=thread)
         if (datetime.now() - start).seconds > dataset_wait:
@@ -317,7 +318,7 @@ def kronos_dataset(once=False, thread=0, dataset_queue=None):
             start = datetime.now()
         sleep(10)
     # once again for the backlog
-    die(executable='rucio-dataset', hostname=hostname, pid=pid, thread=thread)
+    die(executable='kronos-dataset', hostname=hostname, pid=pid, thread=thread)
     logging.info('(kronos_dataset) cleaning dataset backlog before shutdown...')
     __update_datasets(dataset_queue)
 
diff --git a/lib/rucio/web/ui/main.py b/lib/rucio/web/ui/main.py
--- a/lib/rucio/web/ui/main.py
+++ b/lib/rucio/web/ui/main.py
@@ -12,11 +12,17 @@
  - Martin Barisits, <martin.barisits@cern.ch>, 2014
  - Ralph Vigne <ralph.vigne@cern.ch>, 2015
  - Cedric Serfon <cedric.serfon@cern.ch>, 2015-2017
+ - Stefan Prenner <stefan.prenner@cern.ch>, 2017-2018
 """
 
 
+from io import BytesIO
+from json import dumps
 from os.path import dirname, join
 
+from gzip import GzipFile
+from requests import get, ConnectionError
+from tarfile import open, TarError
 from web import application, header, input as param_input, seeother, template
 
 from rucio.common.config import config_get
@@ -49,7 +55,9 @@
     '/subscriptions/rules', 'SubscriptionRules',
     '/subscription', 'Subscription',
     '/subscriptions', 'Subscriptions',
-    '/subscriptions_editor', 'SubscriptionsEditor'
+    '/subscriptions_editor', 'SubscriptionsEditor',
+    '/logfiles/load', 'LoadLogfile',
+    '/logfiles/extract', 'ExtractLogfile'
 )
 
 POLICY = config_get('permission', 'policy')
@@ -352,6 +360,72 @@ def GET(self):  # pylint:disable=no-self-use,invalid-name
         return check_token(render.subscriptions_editor())
 
 
+class LoadLogfile():
+    """ Loads logfile content list """
+    def GET(self):
+        try:
+            data = param_input()
+            response = get(str(data.file_location), cert=config_get('webui', 'usercert'), verify=False)
+            if not response.ok:
+                response.raise_for_status()
+            cont = response.content
+            file_like_object = BytesIO(cont)
+            tar = open(mode='r:gz', fileobj=file_like_object)
+            jsonResponse = {}
+            for member in tar.getmembers():
+                jsonResponse[member.name] = member.size
+            header('Content-Type', 'application/json')
+            return dumps(jsonResponse)
+        except ConnectionError, err:
+            raise generate_http_error(503, str(type(err)), str(err))
+        except TarError, err:
+            raise generate_http_error(415, str(type(err)), str(err))
+        except IOError, err:
+            raise generate_http_error(422, str(type(err)), str(err))
+        except Exception, err:
+            raise generate_http_error(500, str(type(err)), str(err))
+
+
+class ExtractLogfile():
+    """ Extracts selected logfile content """
+    def GET(self):
+        try:
+            pyDict = {}
+            data = param_input()
+            response = get(str(data.file_location), cert=config_get('webui', 'usercert'), verify=False)
+            if not response.ok:
+                response.raise_for_status()
+            cont = response.content
+            file_like_object = BytesIO(cont)
+            tar = open(mode='r:gz', fileobj=file_like_object)
+            for member in tar.getmembers():
+                if member.name == str(data.file_name):
+                    try:
+                        f = tar.extractfile(member)
+                        pyDict['content'] = f.read(16000000)
+                        pyDict['size'] = f.tell()
+                        jsonResponse = dumps(pyDict)
+                        tar.close()
+                        return jsonResponse
+                    except UnicodeDecodeError:
+                        f = tar.extractfile(member)
+                        out = GzipFile(fileobj=f)
+                        pyDict['content'] = out.read(16000000)
+                        pyDict['size'] = out.tell()
+                        jsonResponse = dumps(pyDict)
+                        tar.close()
+                        return jsonResponse
+                    return "ok"
+        except ConnectionError, err:
+            raise generate_http_error(503, str(type(err)), str(err))
+        except TarError, err:
+            raise generate_http_error(415, str(type(err)), str(err))
+        except IOError, err:
+            raise generate_http_error(422, str(type(err)), str(err))
+        except Exception, err:
+            raise generate_http_error(500, str(type(err)), str(err))
+
+
 """----------------------
    Web service startup
 ----------------------"""


Test patch: