mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 22:41:12 +02:00
Replace decode errors when reading device configs.
This commit is contained in:
1 parent
e817c13738
commit
61ef750da3
7 files changed
+11
-11
No files matched your search
@@ -336,7 +336,7 @@ class VPCS(IModule):
|
||||
if os.path.isfile(request["script_file"]) and request["script_file"] != config_path:
|
||||
# this is a local file set in the GUI
|
||||
try:
|
||||
with open(request["script_file"], "r") as f:
|
||||
with open(request["script_file"], "r", errors="replace") as f:
|
||||
config = f.read()
|
||||
with open(config_path, "w") as f:
|
||||
config = config.replace("\r", "")
|
||||
|
||||
@@ -170,7 +170,7 @@ class VPCSDevice(object):
|
||||
config_path = os.path.join(self._working_dir, "startup.vpc")
|
||||
if os.path.isfile(config_path):
|
||||
try:
|
||||
with open(config_path, "r+") as f:
|
||||
with open(config_path, "r+", errors="replace") as f:
|
||||
old_config = f.read()
|
||||
new_config = old_config.replace(self._name, new_name)
|
||||
f.seek(0)
|
||||
@@ -388,7 +388,7 @@ class VPCSDevice(object):
|
||||
output = ""
|
||||
if self._vpcs_stdout_file:
|
||||
try:
|
||||
with open(self._vpcs_stdout_file) as file:
|
||||
with open(self._vpcs_stdout_file, errors="replace") as file:
|
||||
output = file.read()
|
||||
except OSError as e:
|
||||
log.warn("could not read {}: {}".format(self._vpcs_stdout_file, e))
|
||||
|
||||
Reference in new issue
Block a user