mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-13 20:08:55 +00:00
Support VPCS 0.6.1
This commit is contained in:
parent
63edcc1c34
commit
3f4da9050c
@ -197,7 +197,7 @@ class VPCSVM(BaseVM):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _check_vpcs_version(self):
|
def _check_vpcs_version(self):
|
||||||
"""
|
"""
|
||||||
Checks if the VPCS executable version is >= 0.8b.
|
Checks if the VPCS executable version is >= 0.8b or == 0.6.1.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
output = yield from subprocess_check_output(self.vpcs_path, "-v", cwd=self.working_dir)
|
output = yield from subprocess_check_output(self.vpcs_path, "-v", cwd=self.working_dir)
|
||||||
@ -205,8 +205,8 @@ class VPCSVM(BaseVM):
|
|||||||
if match:
|
if match:
|
||||||
version = match.group(1)
|
version = match.group(1)
|
||||||
self._vpcs_version = parse_version(version)
|
self._vpcs_version = parse_version(version)
|
||||||
if self._vpcs_version < parse_version("0.8b"):
|
if self._vpcs_version < parse_version("0.8b") and self._vpcs_version != parse_version("0.6.1"):
|
||||||
raise VPCSError("VPCS executable version must be >= 0.8b")
|
raise VPCSError("VPCS executable version must be >= 0.8b or 0.6.1")
|
||||||
else:
|
else:
|
||||||
raise VPCSError("Could not determine the VPCS version for {}".format(self.vpcs_path))
|
raise VPCSError("Could not determine the VPCS version for {}".format(self.vpcs_path))
|
||||||
except (OSError, subprocess.SubprocessError) as e:
|
except (OSError, subprocess.SubprocessError) as e:
|
||||||
|
@ -56,6 +56,12 @@ def test_vm_check_vpcs_version(loop, vm, manager):
|
|||||||
assert vm._vpcs_version == parse_version("0.9")
|
assert vm._vpcs_version == parse_version("0.9")
|
||||||
|
|
||||||
|
|
||||||
|
def test_vm_check_vpcs_version_0_6_1(loop, vm, manager):
|
||||||
|
with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.subprocess_check_output", return_value="Welcome to Virtual PC Simulator, version 0.6.1"):
|
||||||
|
loop.run_until_complete(asyncio.async(vm._check_vpcs_version()))
|
||||||
|
assert vm._vpcs_version == parse_version("0.6.1")
|
||||||
|
|
||||||
|
|
||||||
def test_vm_invalid_vpcs_version(loop, manager, vm):
|
def test_vm_invalid_vpcs_version(loop, manager, vm):
|
||||||
with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.subprocess_check_output", return_value="Welcome to Virtual PC Simulator, version 0.1"):
|
with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.subprocess_check_output", return_value="Welcome to Virtual PC Simulator, version 0.1"):
|
||||||
with pytest.raises(VPCSError):
|
with pytest.raises(VPCSError):
|
||||||
|
Loading…
Reference in New Issue
Block a user