diff --git a/monkey/monkey_island/cc/services/directory_file_storage_service.py b/monkey/monkey_island/cc/services/directory_file_storage_service.py index f8aeebe21..a4be91522 100644 --- a/monkey/monkey_island/cc/services/directory_file_storage_service.py +++ b/monkey/monkey_island/cc/services/directory_file_storage_service.py @@ -54,6 +54,7 @@ class DirectoryFileStorageService(IFileStorageService): logger.debug(f"Deleting {safe_file_path}") safe_file_path.unlink() except FileNotFoundError: + # This method is idempotent. pass def _get_safe_file_path(self, unsafe_file_name: str): diff --git a/monkey/monkey_island/cc/services/i_file_storage_service.py b/monkey/monkey_island/cc/services/i_file_storage_service.py index 5903c07d1..31c49cd00 100644 --- a/monkey/monkey_island/cc/services/i_file_storage_service.py +++ b/monkey/monkey_island/cc/services/i_file_storage_service.py @@ -38,6 +38,9 @@ class IFileStorageService(metaclass=abc.ABCMeta): """ Delete a file + This method will delete the file specified by `unsafe_file_name`. This operation is + idempotent and will succeed if the file to be deleted does not exist. + :param unsafe_file_name: An unsanitized file name that identifies the file to be deleted """ pass