Repository: EdinburghGenomics/EGCG-Core

Issue:
Broken recursion in archive_management
In archive_management.register_for_archiving, the recursion is called with the built-in function `filter`, which can only be a typo.

Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f304aea..260484f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,10 @@
 Changelog for EGCG-Core
 ===========================
 
-0.8 (unreleased)
+0.7.4 (unreleased)
 ----------------
 
-- Nothing changed yet.
+- Bugfix in archive management.
 
 
 0.7.3 (2017-09-01)
diff --git a/egcg_core/archive_management.py b/egcg_core/archive_management.py
index 58c5eb9..c5f5f2c 100644
--- a/egcg_core/archive_management.py
+++ b/egcg_core/archive_management.py
@@ -95,7 +95,7 @@ def register_for_archiving(file_path, strict=False):
             raise ArchivingError('Registering %s for archiving to tape failed' % file_path)
         # Registering for archive can sometime take time so give it a second
         sleep(1)
-        return register_for_archiving(filter, strict=True)
+        return register_for_archiving(file_path, strict=True)
 
     return True
 


Test patch:
diff --git a/tests/test_archive_management.py b/tests/test_archive_management.py
index 5d45646..0506957 100644
--- a/tests/test_archive_management.py
+++ b/tests/test_archive_management.py
@@ -80,6 +80,16 @@ class TestArchiveManagement(TestEGCG):
             assert get_stdout.call_count == 3
             assert get_stdout.call_args_list[1][0] == ('lfs hsm_archive testfile',)
 
+        with patch('egcg_core.archive_management._get_stdout',
+                   side_effect=[
+                       'testfile: (0x00000001)', '', 'testfile: (0x00000001)',
+                       'testfile: (0x00000001)', '', 'testfile: (0x00000001)',
+                   ]) as get_stdout:
+            self.assertRaises(ArchivingError, register_for_archiving, 'testfile', False)
+            assert get_stdout.call_count == 6
+            assert get_stdout.call_args_list[1][0] == ('lfs hsm_archive testfile',)
+            assert get_stdout.call_args_list[4][0] == ('lfs hsm_archive testfile',)
+
     def test_recall_from_tape(self):
         with patch('egcg_core.archive_management._get_stdout',
                    side_effect=[