Skip to content

Commit

Permalink
fixing bug where the yearly cull would not look for files on the remo…
Browse files Browse the repository at this point in the history
…te device if set to remote
  • Loading branch information
djotaku committed Oct 2, 2024
1 parent 8a27e0e commit 04d9892
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion snapintime/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 4 additions & 3 deletions snapintime/culling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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


Expand Down

0 comments on commit 04d9892

Please sign in to comment.