mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Fix crash if a private config exist in IOS but no private config file
Fix #217
This commit is contained in:
parent
78891ae00e
commit
d9de1718b7
@ -1498,7 +1498,7 @@ class Router(BaseVM):
|
|||||||
if self.startup_config or self.private_config:
|
if self.startup_config or self.private_config:
|
||||||
module_workdir = self.project.module_working_directory(self.manager.module_name.lower())
|
module_workdir = self.project.module_working_directory(self.manager.module_name.lower())
|
||||||
startup_config_base64, private_config_base64 = yield from self.extract_config()
|
startup_config_base64, private_config_base64 = yield from self.extract_config()
|
||||||
if startup_config_base64:
|
if self.startup_config and startup_config_base64:
|
||||||
try:
|
try:
|
||||||
config = base64.b64decode(startup_config_base64).decode("utf-8", errors="replace")
|
config = base64.b64decode(startup_config_base64).decode("utf-8", errors="replace")
|
||||||
config = "!\n" + config.replace("\r", "")
|
config = "!\n" + config.replace("\r", "")
|
||||||
@ -1509,7 +1509,7 @@ class Router(BaseVM):
|
|||||||
except (binascii.Error, OSError) as e:
|
except (binascii.Error, OSError) as e:
|
||||||
raise DynamipsError("Could not save the startup configuration {}: {}".format(config_path, e))
|
raise DynamipsError("Could not save the startup configuration {}: {}".format(config_path, e))
|
||||||
|
|
||||||
if private_config_base64:
|
if self.private_config and private_config_base64:
|
||||||
try:
|
try:
|
||||||
config = base64.b64decode(private_config_base64).decode("utf-8", errors="replace")
|
config = base64.b64decode(private_config_base64).decode("utf-8", errors="replace")
|
||||||
config = "!\n" + config.replace("\r", "")
|
config = "!\n" + config.replace("\r", "")
|
||||||
|
Loading…
Reference in New Issue
Block a user