From 22cd6973666c4c16607c8d1aa86d9dbe28f63df2 Mon Sep 17 00:00:00 2001 From: Eric Mesa Date: Mon, 9 Mar 2020 16:22:14 -0400 Subject: [PATCH] Added full path for btrfs So that it can run from cron --- TODO | 3 --- snapintime/__init__.py | 2 +- snapintime/culling.py | 2 +- snapintime/remote_backup.py | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 58a5a43..5329b90 100644 --- a/TODO +++ b/TODO @@ -34,9 +34,6 @@ Go back to previous year -> cull to one per quarter 6 March import: -For culling: use sorted(glob result) - - Dev steps: Full Code coverage on current code (pytest all or ignore line - like w/ if __name__ == __main__ Local Culling / unit tests diff --git a/snapintime/__init__.py b/snapintime/__init__.py index 2741d1b..679d5ea 100644 --- a/snapintime/__init__.py +++ b/snapintime/__init__.py @@ -1,5 +1,5 @@ __author__ = "Eric Mesa" -__version__ = "0.8.1" +__version__ = "0.8.2" __license__ = "GNU GPL v3.0" __copyright__ = "(c) 2014 Eric Mesa" __email__ = "ericsbinaryworld at gmail dot com" diff --git a/snapintime/culling.py b/snapintime/culling.py index e67eb19..0bd1567 100644 --- a/snapintime/culling.py +++ b/snapintime/culling.py @@ -77,7 +77,7 @@ def btrfs_del(directory: str, subvols: list) -> list: return_list = [] if len(subvols) > 0: for subvol in subvols: - command = f"btrfs sub del {directory}/{subvol}" + command = f"/usr/sbin/btrfs sub del {directory}/{subvol}" try: raw_result = subprocess.run(command, capture_output=True, shell=True, check=True, text=True) return_text = f"Ran {raw_result.args} with a return code of {raw_result.returncode}.\n"\ diff --git a/snapintime/remote_backup.py b/snapintime/remote_backup.py index 22ccb01..5835e75 100644 --- a/snapintime/remote_backup.py +++ b/snapintime/remote_backup.py @@ -64,7 +64,7 @@ def btrfs_send_receive(local_subvols: list, remote_subvol: str, backup_location: :returns: A dictionary with the result of the command. """ sorted_local = sorted(local_subvols) - command = f"btrfs send -p {backup_location}/{remote_subvol} {backup_location}/{sorted_local[-1]} | ssh {remote_location} btrfs receive {remote_subvol_dir}" + command = f"/usr/sbin/btrfs send -p {backup_location}/{remote_subvol} {backup_location}/{sorted_local[-1]} | ssh {remote_location} btrfs receive {remote_subvol_dir}" try: raw_result = subprocess.run(command, capture_output=True, shell=True, check=True, text=True) result = {"Command": raw_result.args, "Return Code": raw_result.returncode, "Output": raw_result.stdout}