Removed explicit deleting of file with NamedTemporaryFile
This commit is contained in:
		
					parent
					
						
							
								511a1551d5
							
						
					
				
			
			
				commit
				
					
						221af96c8b
					
				
			
		
					 2 changed files with 0 additions and 12 deletions
				
			
		|  | @ -106,12 +106,6 @@ class UserHostingKeyForm(forms.ModelForm): | ||||||
|                 logger.debug( |                 logger.debug( | ||||||
|                     "Not a correct ssh format {error}".format(error=str(cpe))) |                     "Not a correct ssh format {error}".format(error=str(cpe))) | ||||||
|                 raise forms.ValidationError(KEY_ERROR_MESSAGE) |                 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 |         return openssh_pubkey_str | ||||||
| 
 | 
 | ||||||
|     def clean_name(self): |     def clean_name(self): | ||||||
|  |  | ||||||
|  | @ -68,12 +68,6 @@ def save_ssh_key(self, hosts, keys): | ||||||
|         except Exception as cdist_exception: |         except Exception as cdist_exception: | ||||||
|             logger.error(cdist_exception) |             logger.error(cdist_exception) | ||||||
|             return_value = False |             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 |     return return_value | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue