From 04d9892f7545d02de5a9296354a7374bf409afbf Mon Sep 17 00:00:00 2001 From: Eric Mesa Date: Wed, 2 Oct 2024 18:36:16 -0400 Subject: [PATCH] fixing bug where the yearly cull would not look for files on the remote device if set to remote --- snapintime/__init__.py | 2 +- snapintime/culling.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/snapintime/__init__.py b/snapintime/__init__.py index b427e34..f44a59a 100644 --- a/snapintime/__init__.py +++ b/snapintime/__init__.py @@ -1,5 +1,5 @@ __author__ = "Eric Mesa" -__version__ = "2.2.1" +__version__ = "2.2.2" __license__ = "GNU GPL v3.0" __copyright__: str = "(c) 2014 - 2024 Eric Mesa" __email__: str = "ericsbinaryworld at gmail dot com" diff --git a/snapintime/culling.py b/snapintime/culling.py index 410ecfa..a55368c 100644 --- a/snapintime/culling.py +++ b/snapintime/culling.py @@ -237,6 +237,7 @@ def cull_last_year(configuration: dict, remote: bool = False) -> list: :returns: A list containing the results of running the commands. """ last_year: list = snapintime.utils.date.yearly_quarters(datetime.now()) + location: str = "remote_subvol_dir" if remote else "backuplocation" return_list = [] for subvol in configuration.values(): for quarter in last_year: @@ -245,13 +246,13 @@ def cull_last_year(configuration: dict, remote: bool = False) -> list: reg_ex_string = f"{reg_ex_string}({day.strftime('%Y-%m-%d')})|" reg_ex_string_minus_final_or = reg_ex_string[:-1] quarterly_reg_ex = re.compile(reg_ex_string_minus_final_or) - subvols_this_quarter = get_subvols_by_date(subvol.get("backuplocation"), quarterly_reg_ex) + subvols_this_quarter = get_subvols_by_date(subvol.get(location), quarterly_reg_ex) if remote: subvols_this_quarter = remove_protected(subvol, subvols_this_quarter) if len(subvols_this_quarter) != 0: this_quarter_culled = generate_quarterly_yearly_cull_list(subvols_this_quarter) - return_list.append(btrfs_del(subvol.get("backuplocation"), this_quarter_culled, remote, - remote_location=subvol.get('remote_location'))) + return_list.append(btrfs_del(subvol.get(location), this_quarter_culled, remote, + remote_location=subvol.get(location))) return return_list