Index: /branches/ipp-259_genericise_backups/tools/backups/backup.py
===================================================================
--- /branches/ipp-259_genericise_backups/tools/backups/backup.py	(revision 40923)
+++ /branches/ipp-259_genericise_backups/tools/backups/backup.py	(revision 40924)
@@ -1,3 +1,4 @@
 import configparser
+import datetime
 import os.path as path
 import socket
@@ -153,14 +154,39 @@
     def _run_tar(self):
         if self.run_tar is None or False:
-            return False
-        return True
+            return 0
+
+        dests = self.default_dict['backup_paths']
+
+        filename = self.tar_dict['target_filename']
+        if 'prefix_date' in self.tar_dict.keys() and self.tar_dict['prefix_date']:
+            filename = f"{get_date()}_{filename}"
+        filename = path.join(dests[0], filename)  # may need some tar suffix magic
+
+        add_args = [] if 'additional_args' not in self.tar_dict.keys() else self.tar_dict['additional_args']
+        all_args = add_args + [filename] + self.tar_dict['sources']
+
+        try:
+            print(all_args)
+            sub_utils.tar_wrapper(all_args)
+            sub_utils.chmod_wrapper(['774', filename])
+            # copy to backups
+            if len(dests) == 1:
+                return 0
+            for d in range(1, len(dests)):
+                sub_utils.cp_wrapper([ filename, dests[d]])
+        except errs.SubprocessError as e:
+            raise errs.SubprocessError() from e
+        return 0
 
     def _run_rsync(self):
-        if self.run_rsync is None or False:
-            return False
-        return True
+        raise Exception("Not implemented")
 
     def _run_mysqldump(self):
-        if self.run_mysqldump is None or False:
-            return False
-        return True
+        raise Exception("Not implemented")
+
+
+def get_date(custom_date=None, custom_format="%Y-%b-%d"):
+        # Format is currently: 2019-10-08
+        if custom_date is not None:
+            return custom_date.strftime(custom_format)
+        return datetime.date.today().strftime(custom_format)
Index: /branches/ipp-259_genericise_backups/tools/backups/backup_test.py
===================================================================
--- /branches/ipp-259_genericise_backups/tools/backups/backup_test.py	(revision 40923)
+++ /branches/ipp-259_genericise_backups/tools/backups/backup_test.py	(revision 40924)
@@ -5,4 +5,5 @@
 from pathlib import Path
 
+import backups.backup as bckup
 import backups.utils.errors as errs
 from backups.backup import Backup
@@ -243,11 +244,58 @@
 
 
-# class TestRunningTar():
-
-#     def test_simply_tar(self):
-#         assert True is False
-
-#     def test_tar_with_additional_args(self):
-#         assert True is False
+class TestRunningTar():
+
+    def test_simply_tar(self, tmpdir):
+        config = make_default_config(tmpdir, ['bck1'])
+        source = os.path.join(tmpdir, "folder_to_tar")
+        os.makedirs(source)
+        # put a file in it
+        Path(os.path.join(source, "a_file.txt"))
+
+        config['TAR'] = \
+        { 'sources' : f"{source}"
+        , 'additional_args' : "-C / -cf"
+        , 'target_filename' : 'cool_tar.tar'
+        , 'prefix_date' : 'False'
+        }
+
+        backy = Backup(config)
+
+        expected_tar1 = os.path.join(tmpdir, 'bck1', 'cool_tar.tar')
+        assert not os.path.exists(expected_tar1)
+        backy._run_tar()
+        print(expected_tar1)
+        assert os.path.exists(expected_tar1)
+
+    def test_tar_with_multiple_sources_and_date(self, tmpdir):
+        config = make_default_config(tmpdir, ['bck1', 'bck2'])
+        source1 = os.path.join(tmpdir, "folder_to_tar")
+        source2 = os.path.join(tmpdir, "another_folder_to_tar")
+        os.makedirs(source1)
+        os.makedirs(source2)
+        # put a file in it
+        Path(os.path.join(source1, "a_file.txt"))
+        Path(os.path.join(source2, "other.file"))
+
+        config['TAR'] = \
+        { 'sources' : f"{source1}, {source2}"
+        , 'additional_args' : "-C / -cf"
+        , 'target_filename' : 'cool_tar.tar'
+        , 'prefix_date' : 'True'
+        }
+
+        backy = Backup(config)
+
+        date = bckup.get_date()
+
+        expected_tar1 = os.path.join(tmpdir, 'bck1', f'{date}_cool_tar.tar')
+        expected_tar2 = os.path.join(tmpdir, 'bck2', f'{date}_cool_tar.tar')
+        assert not os.path.exists(expected_tar1)
+        assert not os.path.exists(expected_tar2)
+        backy._run_tar()
+        print(expected_tar1)
+        print(expected_tar2)
+        assert os.path.exists(expected_tar1)
+        assert os.path.exists(expected_tar2)
 
 
