Fix error when the startup config file is missing

Fix https://github.com/GNS3/gns3-gui/issues/1877
This commit is contained in:
Julien Duponchelle 2017-02-22 09:28:34 +01:00
parent b132d95a04
commit 2884a40769
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -1551,8 +1551,11 @@ class Router(BaseNode):
try:
startup_config_path = os.path.join(self._working_directory, startup_config)
with open(startup_config_path) as f:
self._startup_config_content = f.read()
if os.path.exists(startup_config_path):
with open(startup_config_path) as f:
self._startup_config_content = f.read()
else:
self._startup_config_content = ''
except OSError as e:
raise DynamipsError("Cannot access the startup-config {}: {}".format(startup_config_path, e))