Replace decode errors when reading device configs.

This commit is contained in:
grossmj
2014-05-29 12:59:13 -06:00
parent e817c13738
commit 61ef750da3
7 changed files with 11 additions and 11 deletions

View File

@ -223,7 +223,7 @@ class Router(object):
startup_config_path = os.path.join(self.hypervisor.working_dir, "configs", "{}.cfg".format(self.name))
if os.path.isfile(startup_config_path):
try:
with open(startup_config_path, "r+") as f:
with open(startup_config_path, "r+", errors="replace") as f:
old_config = f.read()
new_config = old_config.replace(self.name, new_name)
f.seek(0)
@ -239,7 +239,7 @@ class Router(object):
private_config_path = os.path.join(self.hypervisor.working_dir, "configs", "{}-private.cfg".format(self.name))
if os.path.isfile(private_config_path):
try:
with open(private_config_path, "r+") as f:
with open(private_config_path, "r+", errors="replace") as f:
old_config = f.read()
new_config = old_config.replace(self.name, new_name)
f.seek(0)