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

Fixes initial-configs that were not restored when opening a project containing IOU VMs.

This commit is contained in:
grossmj 2015-04-15 19:49:40 -06:00
parent e367f95f96
commit aeab9780d8
2 changed files with 6 additions and 10 deletions

View File

@ -59,8 +59,6 @@ class IOUHandler:
for name, value in request.json.items():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
if "initial_config_content" in request.json:
vm.initial_config = request.json.get("initial_config_content")
response.set_status(201)
response.json(vm)
@ -108,8 +106,6 @@ class IOUHandler:
for name, value in request.json.items():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
if "initial_config_content" in request.json:
vm.initial_config = request.json.get("initial_config_content")
response.json(vm)
@classmethod

View File

@ -317,9 +317,9 @@ class IOUVM(BaseVM):
"""
if self.initial_config_file:
content = self.initial_config
content = self.initial_config_content
content = content.replace(self._name, new_name)
self.initial_config = content
self.initial_config_content = content
super(IOUVM, IOUVM).name.__set__(self, new_name)
@ -939,7 +939,7 @@ class IOUVM(BaseVM):
log.warn("could not determine if layer 1 keepalive messages are supported by {}: {}".format(os.path.basename(self._path), e))
@property
def initial_config(self):
def initial_config_content(self):
"""
Returns the content of the current initial-config file.
"""
@ -952,10 +952,10 @@ class IOUVM(BaseVM):
with open(config_file) as f:
return f.read()
except OSError as e:
raise IOUError("Can't read configuration file '{}'".format(config_file))
raise IOUError("Can't read configuration file '{}': {}".format(config_file, e))
@initial_config.setter
def initial_config(self, initial_config):
@initial_config_content.setter
def initial_config_content(self, initial_config):
"""
Update the initial config