Conveyor receiver does not consume messages
Motivation
----------
The conveyor receiver does not consume messages at the moment.

Modification
------------
The 'vo' field moved from headers to messages and needs to be checked there. Also the check for `false` on `msg['job_m_replica']` and the check for `true` on `msg['job_m_replica']` needs to be lowered.

diff --git a/lib/rucio/common/policy.py b/lib/rucio/common/policy.py
index 62403709c..cf88687e4 100644
--- a/lib/rucio/common/policy.py
+++ b/lib/rucio/common/policy.py
@@ -8,7 +8,7 @@
 
  Authors:
  - Cedric Serfon, <cedric.serfon@cern.ch>, 2016-2017
- - Martin Barisits, <martin.barisits@cern.ch>, 2017
+ - Martin Barisits, <martin.barisits@cern.ch>, 2017-2018
  - Vincent Garonne, <vincent.garonne@cern.ch>, 2017
 """
 
@@ -37,7 +37,7 @@ def get_policy():
     policy = REGION.get('policy')
     if isinstance(policy, NoValue):
         try:
-            policy = config_get('permission', 'policy')
+            policy = config_get('policy', 'permission')
         except (NoOptionError, NoSectionError):
             policy = 'atlas'
         REGION.set('policy', policy)
diff --git a/lib/rucio/daemons/conveyor/receiver.py b/lib/rucio/daemons/conveyor/receiver.py
index f7a941968..933f666b2 100644
--- a/lib/rucio/daemons/conveyor/receiver.py
+++ b/lib/rucio/daemons/conveyor/receiver.py
@@ -9,7 +9,7 @@
 # - Mario Lassnig, <mario.lassnig@cern.ch>, 2013-2015
 # - Vincent Garonne, <vincent.garonne@cern.ch>, 2014
 # - Wen Guan, <wen.guan@cern.ch>, 2014-2016
-# - Martin Barisits, <martin.barisits@cern.ch>, 2017
+# - Martin Barisits, <martin.barisits@cern.ch>, 2017-2018
 
 """
 Conveyor is a daemon to manage file transfers.
@@ -30,6 +30,7 @@ import json
 import stomp
 
 from rucio.common.config import config_get, config_get_int
+from rucio.common.policy import get_policy
 from rucio.core import heartbeat, request
 from rucio.core.monitor import record_counter
 from rucio.core.transfer import set_transfer_update_time
@@ -60,17 +61,21 @@ class Receiver(object):
     def on_message(self, headers, message):
         record_counter('daemons.conveyor.receiver.message_all')
 
-        if 'vo' not in headers or headers['vo'] != 'atlas':
+        try:
+            msg = json.loads(message)
+        except Exception, e:
+            msg = json.loads(message[:-1])  # Note: I am not sure if this is needed anymore, this was due to an unparsable EOT character
+
+        if 'vo' not in msg or msg['vo'] != get_policy():
             return
 
-        msg = json.loads(message[:-1])  # message always ends with an unparseable EOT character
         if 'job_metadata' in msg.keys() \\
            and isinstance(msg['job_metadata'], dict) \\
            and 'issuer' in msg['job_metadata'].keys() \\
            and str(msg['job_metadata']['issuer']) == str('rucio'):
 
             if 'job_m_replica' in msg.keys() and 'job_state' in msg.keys() \\
-               and (str(msg['job_m_replica']) == str('false') or (str(msg['job_m_replica']) == str('true') and str(msg['job_state']) != str('ACTIVE'))):
+               and (str(msg['job_m_replica']).lower() == str('false') or (str(msg['job_m_replica']).lower() == str('true') and str(msg['job_state']) != str('ACTIVE'))):
 
                 if 'request_id' in msg['job_metadata']:
                     # submitted by old submitter
['lib/rucio/daemons/conveyor/receiver.py', 'lib/rucio/common/policy.py']