From 221af96c8b1c0d80ae39f02b239a2ad4f257b84e Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 13 Sep 2017 02:46:54 +0530 Subject: [PATCH] Removed explicit deleting of file with NamedTemporaryFile --- hosting/forms.py | 6 ------ utils/tasks.py | 6 ------ 2 files changed, 12 deletions(-) diff --git a/hosting/forms.py b/hosting/forms.py index 8aff59d4..23f7b3f6 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -106,12 +106,6 @@ class UserHostingKeyForm(forms.ModelForm): logger.debug( "Not a correct ssh format {error}".format(error=str(cpe))) raise forms.ValidationError(KEY_ERROR_MESSAGE) - try: - os.remove(tmp_public_key_file.name) - except FileNotFoundError: - logger.debug( - "{} could not be deleted because it doesn't exist".format( - tmp_public_key_file.name)) return openssh_pubkey_str def clean_name(self): diff --git a/utils/tasks.py b/utils/tasks.py index ecad5c71..d9b40ac3 100644 --- a/utils/tasks.py +++ b/utils/tasks.py @@ -68,12 +68,6 @@ def save_ssh_key(self, hosts, keys): except Exception as cdist_exception: logger.error(cdist_exception) return_value = False - try: - os.remove(tmp_manifest.name) - except FileNotFoundError: - logger.debug( - "{} could not be deleted because it doesn't exist".format( - tmp_manifest.name)) return return_value