mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Delete vlan.dat for L2IOL during config import. Fixes #1285.
This commit is contained in:
parent
df7d26e418
commit
313226786f
@ -65,10 +65,6 @@ class IOUHandler:
|
||||
if name == "private_config_content" and (vm.private_config_content and len(vm.private_config_content) > 0):
|
||||
continue
|
||||
setattr(vm, name, value)
|
||||
if "startup_config_content" in request.json:
|
||||
vm.startup_config = request.json.get("startup_config_content")
|
||||
if "private_config_content" in request.json:
|
||||
vm.private_config = request.json.get("private_config_content")
|
||||
response.set_status(201)
|
||||
response.json(vm)
|
||||
|
||||
@ -112,14 +108,9 @@ class IOUHandler:
|
||||
|
||||
iou_manager = IOU.instance()
|
||||
vm = iou_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
|
||||
|
||||
for name, value in request.json.items():
|
||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||
setattr(vm, name, value)
|
||||
if "startup_config_content" in request.json:
|
||||
vm.startup_config = request.json.get("startup_config_content")
|
||||
if "private_config_content" in request.json:
|
||||
vm.private_config = request.json.get("private_config_content")
|
||||
response.json(vm)
|
||||
|
||||
@classmethod
|
||||
|
@ -1064,6 +1064,14 @@ class IOUVM(BaseVM):
|
||||
else:
|
||||
startup_config = startup_config.replace("%h", self._name)
|
||||
f.write(startup_config)
|
||||
|
||||
vlan_file = os.path.join(self.working_dir, "vlan.dat-{:05d}".format(self.application_id))
|
||||
if os.path.exists(vlan_file):
|
||||
try:
|
||||
os.remove(vlan_file)
|
||||
except OSError as e:
|
||||
log.error("Could not delete VLAN file '{}': {}".format(vlan_file, e))
|
||||
|
||||
except OSError as e:
|
||||
raise IOUError("Can't write startup-config file '{}': {}".format(startup_config_path, e))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user