From 2b9c190bcf820b3a22991f8088fc8d01f8d833f8 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 4 Oct 2016 17:16:52 +0200 Subject: [PATCH] Handle errors when startup config path is wrong Fix #715 --- gns3server/compute/dynamips/nodes/router.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gns3server/compute/dynamips/nodes/router.py b/gns3server/compute/dynamips/nodes/router.py index bebe6bcc..7b638018 100644 --- a/gns3server/compute/dynamips/nodes/router.py +++ b/gns3server/compute/dynamips/nodes/router.py @@ -1517,8 +1517,13 @@ class Router(BaseNode): except OSError as e: raise DynamipsError("Cannot access the private-config {}: {}".format(private_config_path, e)) - with open(os.path.join(module_workdir, startup_config)) as f: - self._startup_config_content = f.read() + try: + startup_config_path = os.path.join(module_workdir, startup_config) + with open(startup_config_path) as f: + self._startup_config_content = f.read() + except OSError as e: + raise DynamipsError("Cannot access the startup-config {}: {}".format(startup_config_path, e)) + yield from self._hypervisor.send('vm set_config "{name}" "{startup}" "{private}"'.format(name=self._name, startup=startup_config, private=private_config))