From d9de1718b7b9700e7c8c6358535b1381040f9a75 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 5 Jun 2015 15:30:30 +0200 Subject: [PATCH] Fix crash if a private config exist in IOS but no private config file Fix #217 --- gns3server/modules/dynamips/nodes/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index 0b0d6492..c23f10f5 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -1498,7 +1498,7 @@ class Router(BaseVM): if self.startup_config or self.private_config: module_workdir = self.project.module_working_directory(self.manager.module_name.lower()) startup_config_base64, private_config_base64 = yield from self.extract_config() - if startup_config_base64: + if self.startup_config and startup_config_base64: try: config = base64.b64decode(startup_config_base64).decode("utf-8", errors="replace") config = "!\n" + config.replace("\r", "") @@ -1509,7 +1509,7 @@ class Router(BaseVM): except (binascii.Error, OSError) as 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: config = base64.b64decode(private_config_base64).decode("utf-8", errors="replace") config = "!\n" + config.replace("\r", "")