forked from ungleich-public/cdist
		
	Exit cleanly in case of non UTF-8 file.
This commit is contained in:
		
					parent
					
						
							
								d9d739cd44
							
						
					
				
			
			
				commit
				
					
						b5262c850e
					
				
			
		
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -121,9 +121,10 @@ class Config(object):
 | 
				
			||||||
                    host = Config.hostfile_process_line(host)
 | 
					                    host = Config.hostfile_process_line(host)
 | 
				
			||||||
                    if host:
 | 
					                    if host:
 | 
				
			||||||
                        yield host
 | 
					                        yield host
 | 
				
			||||||
            except (IOError, OSError) as e:
 | 
					            except (IOError, OSError, UnicodeError) as e:
 | 
				
			||||||
                raise cdist.Error("Error reading hosts from \'{}\'".format(
 | 
					                raise cdist.Error(
 | 
				
			||||||
                    source))
 | 
					                        "Error reading hosts from file \'{}\': {}".format(
 | 
				
			||||||
 | 
					                            source, e))
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            if source:
 | 
					            if source:
 | 
				
			||||||
                for host in source:
 | 
					                for host in source:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue