diff --git a/gns3server/handlers/api/iou_handler.py b/gns3server/handlers/api/iou_handler.py index dbc3d923..ff32ce1f 100644 --- a/gns3server/handlers/api/iou_handler.py +++ b/gns3server/handlers/api/iou_handler.py @@ -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 diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index fb610ccf..8bbd8bb8 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -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))