Repository: rucio/rucio

Issue:
End of life badly set for non-pledged endpoints
Motivation
----------
The eol_at is set on some rules on non-pledged RSEs. It shouldn't be the case.
docker builds fail with pip install error (pycurl/m2crypto)
Motivation
----------
Currently the docker server and daemon builds fail while installing rucio because of the pycurl dependency needing openssl-devel installed.

Modification
------------
add yum install openssl-devel.x86_64


Discussion:

Resolving patch:
diff --git a/lib/rucio/core/lock.py b/lib/rucio/core/lock.py
--- a/lib/rucio/core/lock.py
+++ b/lib/rucio/core/lock.py
@@ -9,7 +9,7 @@
 # - Martin Barisits, <martin.barisits@cern.ch>, 2013-2017
 # - Mario Lassnig, <mario.lassnig@cern.ch>, 2013-2014
 # - Vincent Garonne, <vincent.garonne@cern.ch>, 2014-2018
-# - Cedric Serfon, <cedric.serfon@cern.ch>, 2014-2017
+# - Cedric Serfon, <cedric.serfon@cern.ch>, 2014-2018
 # - Thomas Beermann, <thomas.beermann@cern.ch>, 2014-2018
 
 import logging
@@ -429,7 +429,8 @@ def touch_dataset_locks(dataset_locks, session=None):
         try:
             session.query(models.DatasetLock).filter_by(scope=dataset_lock['scope'], name=dataset_lock['name'], rse_id=dataset_lock['rse_id']).\
                 update({'accessed_at': dataset_lock.get('accessed_at') or now}, synchronize_session=False)
-            session.query(models.ReplicationRule).filter_by(scope=dataset_lock['scope'], name=dataset_lock['name']).update({'eol_at': eol_at}, synchronize_session=False)
+            for rule_id in session.query(models.DatasetLock.rule_id).filter_by(scope=dataset_lock['scope'], name=dataset_lock['name'], rse_id=dataset_lock['rse_id']):
+                session.query(models.ReplicationRule).filter_by(id=rule_id).update({'eol_at': eol_at}, synchronize_session=False)
         except DatabaseError:
             return False
 
diff --git a/lib/rucio/daemons/atropos.py b/lib/rucio/daemons/atropos.py
--- a/lib/rucio/daemons/atropos.py
+++ b/lib/rucio/daemons/atropos.py
@@ -13,7 +13,7 @@
 # limitations under the License.
 #
 # Authors:
-# - Cedric Serfon <cedric.serfon@cern.ch>, 2016-2017
+# - Cedric Serfon <cedric.serfon@cern.ch>, 2016-2018
 # - Vincent Garonne <vgaronne@gmail.com>, 2018
 
 import datetime
@@ -123,7 +123,7 @@ def atropos(thread, bulk, date_check, dry_run=True, grace_period=86400, once=Tru
                                 logging.warning(prepend_str + 'Cannot find rule %s on DID %s' % (rule.id, did))
 
                     # Now check that the new eol_at is expired
-                    if eol_at < date_check:
+                    if eol_at and eol_at < date_check:
                         no_locks = True
                         for lock in get_dataset_locks(rule.scope, rule.name):
                             if lock['rule_id'] == rule[4]:
@@ -175,7 +175,7 @@ def run(threads=1, bulk=100, date_check=None, dry_run=True, grace_period=86400,
     else:
         date_check = datetime.datetime.strptime(date_check, '%Y-%m-%d')
     if once:
-        logging.info('Will run only one iteration in a single threaded mode')
+        logging.info('Will run only one iteration')
     logging.info('starting atropos threads')
     thread_list = [threading.Thread(target=atropos, kwargs={'once': once,
                                                             'thread': i,
@@ -188,7 +188,7 @@ def run(threads=1, bulk=100, date_check=None, dry_run=True, grace_period=86400,
     logging.info('waiting for interrupts')
 
     # Interruptible joins require a timeout.
-    while len(thread_list) > 0:
+    while thread_list:
         thread_list = [t.join(timeout=3.14) for t in thread_list if t and t.isAlive()]
 
 


Test patch: