forked from ungleich-public/cdist
		
	FileList handle exception when deleting old/unused file
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								589b5a68b9
							
						
					
				
			
			
				commit
				
					
						e70e0569ec
					
				
			
		
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -43,7 +43,11 @@ class FileList(collections.MutableSequence):
 | 
				
			||||||
        self.path = path
 | 
					        self.path = path
 | 
				
			||||||
        if initial:
 | 
					        if initial:
 | 
				
			||||||
            # delete existing file
 | 
					            # delete existing file
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
                os.unlink(self.path)
 | 
					                os.unlink(self.path)
 | 
				
			||||||
 | 
					            except EnvironmentError:
 | 
				
			||||||
 | 
					                # ignored
 | 
				
			||||||
 | 
					                pass
 | 
				
			||||||
            for i in initial:
 | 
					            for i in initial:
 | 
				
			||||||
                self.append(i)
 | 
					                self.append(i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue