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)
|
||||
if host:
|
||||
yield host
|
||||
except (IOError, OSError) as e:
|
||||
raise cdist.Error("Error reading hosts from \'{}\'".format(
|
||||
source))
|
||||
except (IOError, OSError, UnicodeError) as e:
|
||||
raise cdist.Error(
|
||||
"Error reading hosts from file \'{}\': {}".format(
|
||||
source, e))
|
||||
else:
|
||||
if source:
|
||||
for host in source:
|
||||
|
|
Loading…
Reference in a new issue