Skip to content

Commit

Permalink
Catching file not found error in remove_latest command
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaTegner committed Oct 11, 2024
1 parent 8dad64b commit 170588c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tufup/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,10 +832,13 @@ def remove_latest_bundle(self):
archive_path = self.targets_dir / latest_archive.target_path_str
patch_path = archive_path.with_suffix('').with_suffix(SUFFIX_PATCH)
for target_path in [archive_path, patch_path]:
removed = self.roles.remove_target(local_path=target_path)
logger.info(
try:
removed = self.roles.remove_target(local_path=target_path)
logger.info(
f'target {"removed" if removed else "not found"}: {target_path}'
)
except FileNotFoundError:
logger.warning(f'file not found: {target_path}')

def publish_changes(self, private_key_dirs: List[Union[pathlib.Path, str]]):
"""
Expand Down

0 comments on commit 170588c

Please sign in to comment.