1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Handle errors when startup config path is wrong

Fix #715
This commit is contained in:
Julien Duponchelle 2016-10-04 17:16:52 +02:00
parent 7baf584367
commit 2b9c190bcf
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -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:
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))