mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-30 21:03:49 +02:00
Fixes initial-configs that were not restored when opening a project containing IOU VMs.
This commit is contained in:
parent
e367f95f96
commit
aeab9780d8
@ -59,8 +59,6 @@ class IOUHandler:
|
|||||||
for name, value in request.json.items():
|
for name, value in request.json.items():
|
||||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||||
setattr(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.set_status(201)
|
||||||
response.json(vm)
|
response.json(vm)
|
||||||
|
|
||||||
@ -108,8 +106,6 @@ class IOUHandler:
|
|||||||
for name, value in request.json.items():
|
for name, value in request.json.items():
|
||||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||||
setattr(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)
|
response.json(vm)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -317,9 +317,9 @@ class IOUVM(BaseVM):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if self.initial_config_file:
|
if self.initial_config_file:
|
||||||
content = self.initial_config
|
content = self.initial_config_content
|
||||||
content = content.replace(self._name, new_name)
|
content = content.replace(self._name, new_name)
|
||||||
self.initial_config = content
|
self.initial_config_content = content
|
||||||
|
|
||||||
super(IOUVM, IOUVM).name.__set__(self, new_name)
|
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))
|
log.warn("could not determine if layer 1 keepalive messages are supported by {}: {}".format(os.path.basename(self._path), e))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def initial_config(self):
|
def initial_config_content(self):
|
||||||
"""
|
"""
|
||||||
Returns the content of the current initial-config file.
|
Returns the content of the current initial-config file.
|
||||||
"""
|
"""
|
||||||
@ -952,10 +952,10 @@ class IOUVM(BaseVM):
|
|||||||
with open(config_file) as f:
|
with open(config_file) as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
except OSError as e:
|
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
|
@initial_config_content.setter
|
||||||
def initial_config(self, initial_config):
|
def initial_config_content(self, initial_config):
|
||||||
"""
|
"""
|
||||||
Update the initial config
|
Update the initial config
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user