diff --git a/CHANGELOG.md b/CHANGELOG.md index d685ca3..e742760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +# v25.3.0 + +- Add ignore_errors=True to problematic .gnupg removal + # v24.51.0 - Fixing dependency checker in batches diff --git a/pyproject.toml b/pyproject.toml index b974126..d59fac7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "opentaskpy" -version = "v24.51.0" +version = "v25.3.0" authors = [{ name = "Adam McDonagh", email = "adam@elitemonkey.net" }] license = { text = "GPLv3" } classifiers = [ @@ -71,7 +71,7 @@ otf-batch-validator = "opentaskpy.cli.batch_validator:main" profile = 'black' [tool.bumpver] -current_version = "v24.51.0" +current_version = "v25.3.0" version_pattern = "vYY.WW.PATCH[-TAG]" commit_message = "bump version {old_version} -> {new_version}" commit = true diff --git a/src/opentaskpy/remotehandlers/ssh.py b/src/opentaskpy/remotehandlers/ssh.py index f40447a..054d860 100644 --- a/src/opentaskpy/remotehandlers/ssh.py +++ b/src/opentaskpy/remotehandlers/ssh.py @@ -404,19 +404,21 @@ def transfer_files( destination_directory = self.get_staging_directory(remote_spec) # Check that the SFTP client is connected and active - dest_sftp_client = dest_remote_handler.ssh_client.open_sftp() + if dest_remote_handler: + dest_sftp_client = dest_remote_handler.ssh_client.open_sftp() # Create/validate staging directory exists on destination # Use SFTP connection to check if the directory exists - try: - dest_sftp_client.stat(destination_directory) - except FileNotFoundError: - # Create the directory - self.logger.info( - f"[{dest_remote_handler.spec['hostname']}] Creating destination" - f" directory {destination_directory}" - ) - mkdir_p(dest_sftp_client, destination_directory) + if dest_remote_handler: + try: + dest_sftp_client.stat(destination_directory) + except FileNotFoundError: + # Create the directory + self.logger.info( + f"[{dest_remote_handler.spec['hostname']}] Creating destination" + f" directory {destination_directory}" + ) + mkdir_p(dest_sftp_client, destination_directory) # Sanitise arguments files = [quote(file) for file in files] diff --git a/src/opentaskpy/taskhandlers/transfer.py b/src/opentaskpy/taskhandlers/transfer.py index fa18872..6c3ccc4 100644 --- a/src/opentaskpy/taskhandlers/transfer.py +++ b/src/opentaskpy/taskhandlers/transfer.py @@ -773,7 +773,7 @@ def encrypt_files( # Remove the temporary gnupg keychain files under f"{tmpdir}/.gnupg" if path.exists(f"{tmpdir}/.gnupg"): try: - shutil.rmtree(f"{tmpdir}/.gnupg") + shutil.rmtree(f"{tmpdir}/.gnupg", ignore_errors=True) except FileNotFoundError as e: self.logger.warning( f".gnupg deletion failed - FileNotFound but continuing: {e}" @@ -840,7 +840,7 @@ def decrypt_files(self, files: dict, private_key: str) -> dict: # Remove the temporary gnupg keychain files under f"{tmpdir}/.gnupg" if path.exists(f"{tmpdir}/.gnupg"): try: - shutil.rmtree(f"{tmpdir}/.gnupg") + shutil.rmtree(f"{tmpdir}/.gnupg", ignore_errors=True) except FileNotFoundError as e: self.logger.warning( f".gnupg deletion failed - FileNotFound but continuing: {e}" @@ -856,7 +856,7 @@ def decrypt_files(self, files: dict, private_key: str) -> dict: # Check if the directory exists first if path.exists(f"{tmpdir}/.gnupg"): try: - shutil.rmtree(f"{tmpdir}/.gnupg") + shutil.rmtree(f"{tmpdir}/.gnupg", ignore_errors=True) except FileNotFoundError as e: self.logger.warning( f".gnupg deletion failed - FileNotFound but continuing: {e}"