Fix template migration issues from GUI to controller. Fixes https://github.com/GNS3/gns3-gui/issues/2803

This commit is contained in:
grossmj committed 2019-06-15 12:52:50 +02:00
1 parent 61c87e57a4
commit 06ce0868ec
2 files changed
-204

No files matched your search

-91
View File
@@ -106,97 +106,6 @@ def test_import_computes_1_x(controller, controller_config_path, async_run):
assert compute.password is None
def test_import_gns3vm_1_x(controller, controller_config_path, async_run):
"""
At first start the server should import the
gns3vm settings from the gns3_gui 1.X
"""
gns3_gui_conf = {
"Servers": {
"vm": {
"adjust_local_server_ip": True,
"auto_start": True,
"auto_stop": False,
"headless": True,
"remote_vm_host": "",
"remote_vm_password": "",
"remote_vm_port": 3080,
"remote_vm_protocol": "http",
"remote_vm_url": "",
"remote_vm_user": "",
"virtualization": "VMware",
"vmname": "GNS3 VM",
"vmx_path": "/Users/joe/Documents/Virtual Machines.localized/GNS3 VM.vmwarevm/GNS3 VM.vmx"
}
}
}
config_dir = os.path.dirname(controller_config_path)
os.makedirs(config_dir, exist_ok=True)
with open(os.path.join(config_dir, "gns3_gui.conf"), "w+") as f:
json.dump(gns3_gui_conf, f)
controller.gns3vm.settings["engine"] = None
async_run(controller._load_controller_settings())
assert controller.gns3vm.settings["engine"] == "vmware"
assert controller.gns3vm.settings["enable"]
assert controller.gns3vm.settings["headless"]
assert controller.gns3vm.settings["when_exit"] == "keep"
assert controller.gns3vm.settings["vmname"] == "GNS3 VM"
def test_import_remote_gns3vm_1_x(controller, controller_config_path, async_run):
"""
At first start the server should import the
computes and remote GNS3 VM from the gns3_gui 1.X
"""
gns3_gui_conf = {
"Servers": {
"remote_servers": [
{
"host": "127.0.0.1",
"password": "",
"port": 3080,
"protocol": "http",
"url": "http://127.0.0.1:3080",
"user": ""
},
{
"host": "127.0.0.1",
"password": "",
"port": 3081,
"protocol": "http",
"url": "http://127.0.0.1:3081",
"user": ""
}
],
"vm": {
"adjust_local_server_ip": True,
"auto_start": True,
"auto_stop": False,
"headless": True,
"remote_vm_host": "127.0.0.1",
"remote_vm_password": "",
"remote_vm_port": 3081,
"remote_vm_protocol": "http",
"remote_vm_url": "http://127.0.0.1:3081",
"remote_vm_user": "",
"virtualization": "remote",
"vmname": "GNS3 VM",
"vmx_path": "/Users/joe/Documents/Virtual Machines.localized/GNS3 VM.vmwarevm/GNS3 VM.vmx"
}
}
}
config_dir = os.path.dirname(controller_config_path)
os.makedirs(config_dir, exist_ok=True)
with open(os.path.join(config_dir, "gns3_gui.conf"), "w+") as f:
json.dump(gns3_gui_conf, f)
with asyncio_patch("gns3server.controller.compute.Compute.connect"):
async_run(controller._load_controller_settings())
assert controller.gns3vm.settings["engine"] == "remote"
assert controller.gns3vm.settings["vmname"] == "http://127.0.0.1:3081"
def test_load_projects(controller, projects_dir, async_run):
controller.save()