mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-23 14:42:28 +00:00
Cleanup unused and duplicates
This commit is contained in:
parent
58d2a5d4b0
commit
1248584841
@ -24,7 +24,6 @@ from ...web.route import Route
|
|||||||
from ...schemas.project import PROJECT_OBJECT_SCHEMA, PROJECT_CREATE_SCHEMA, PROJECT_UPDATE_SCHEMA, PROJECT_FILE_LIST_SCHEMA, PROJECT_LIST_SCHEMA
|
from ...schemas.project import PROJECT_OBJECT_SCHEMA, PROJECT_CREATE_SCHEMA, PROJECT_UPDATE_SCHEMA, PROJECT_FILE_LIST_SCHEMA, PROJECT_LIST_SCHEMA
|
||||||
from ...modules.project_manager import ProjectManager
|
from ...modules.project_manager import ProjectManager
|
||||||
from ...modules import MODULES
|
from ...modules import MODULES
|
||||||
from ...utils.asyncio import wait_run_in_executor
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
@ -41,8 +40,8 @@ class ProjectHandler:
|
|||||||
description="List projects opened on the server",
|
description="List projects opened on the server",
|
||||||
status_codes={
|
status_codes={
|
||||||
200: "Project list",
|
200: "Project list",
|
||||||
}
|
},
|
||||||
# output=PROJECT_LIST_SCHEMA)
|
output=PROJECT_LIST_SCHEMA
|
||||||
)
|
)
|
||||||
def list_projects(request, response):
|
def list_projects(request, response):
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
from aiohttp.web import HTTPConflict
|
from aiohttp.web import HTTPConflict
|
||||||
from ...web.route import Route
|
from ...web.route import Route
|
||||||
@ -42,7 +41,7 @@ class VirtualBoxHandler:
|
|||||||
200: "Success",
|
200: "Success",
|
||||||
},
|
},
|
||||||
description="Get all VirtualBox VMs available")
|
description="Get all VirtualBox VMs available")
|
||||||
def show(request, response):
|
def index(request, response):
|
||||||
|
|
||||||
vbox_manager = VirtualBox.instance()
|
vbox_manager = VirtualBox.instance()
|
||||||
vms = yield from vbox_manager.list_images()
|
vms = yield from vbox_manager.list_images()
|
||||||
|
@ -41,7 +41,7 @@ class VMwareHandler:
|
|||||||
200: "Success",
|
200: "Success",
|
||||||
},
|
},
|
||||||
description="Get all VMware VMs available")
|
description="Get all VMware VMs available")
|
||||||
def show(request, response):
|
def index(request, response):
|
||||||
|
|
||||||
vmware_manager = VMware.instance()
|
vmware_manager = VMware.instance()
|
||||||
vms = yield from vmware_manager.list_vms()
|
vms = yield from vmware_manager.list_vms()
|
||||||
|
@ -479,14 +479,6 @@ class Dynamips(BaseManager):
|
|||||||
yield from nio.create()
|
yield from nio.create()
|
||||||
return nio
|
return nio
|
||||||
|
|
||||||
@asyncio.coroutine
|
|
||||||
def ghost_ios_support(self, vm):
|
|
||||||
|
|
||||||
ghost_ios_support = self.config.get_section_config("Dynamips").getboolean("ghost_ios_support", True)
|
|
||||||
if ghost_ios_support:
|
|
||||||
with (yield from Dynamips._ghost_ios_lock):
|
|
||||||
yield from self._set_ghost_ios(vm)
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _set_ghost_ios(self, vm):
|
def _set_ghost_ios(self, vm):
|
||||||
"""
|
"""
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
Base interface for NIOs.
|
Base interface for NIOs.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
class NIO(object):
|
class NIO(object):
|
||||||
|
|
||||||
|
@ -143,10 +143,6 @@ class Project:
|
|||||||
if path != self._path and self.is_local() is False:
|
if path != self._path and self.is_local() is False:
|
||||||
raise aiohttp.web.HTTPForbidden(text="You are not allowed to modify the project directory location")
|
raise aiohttp.web.HTTPForbidden(text="You are not allowed to modify the project directory location")
|
||||||
|
|
||||||
old_path = None
|
|
||||||
if hasattr(self, "_path"):
|
|
||||||
old_path = self._path
|
|
||||||
|
|
||||||
self._path = path
|
self._path = path
|
||||||
self._update_temporary_file()
|
self._update_temporary_file()
|
||||||
|
|
||||||
|
@ -1454,7 +1454,6 @@ class QemuVM(BaseVM):
|
|||||||
if self._run_with_kvm(self.qemu_path, self._options):
|
if self._run_with_kvm(self.qemu_path, self._options):
|
||||||
command.extend(["-enable-kvm"])
|
command.extend(["-enable-kvm"])
|
||||||
command.extend(["-boot", "order={}".format(self._boot_priority)])
|
command.extend(["-boot", "order={}".format(self._boot_priority)])
|
||||||
disk_options = yield from self._disk_options()
|
|
||||||
cdrom_option = self._cdrom_option()
|
cdrom_option = self._cdrom_option()
|
||||||
command.extend(cdrom_option)
|
command.extend(cdrom_option)
|
||||||
command.extend((yield from self._disk_options()))
|
command.extend((yield from self._disk_options()))
|
||||||
|
@ -162,7 +162,7 @@ def pid_lock(path):
|
|||||||
except OSError:
|
except OSError:
|
||||||
pid = None
|
pid = None
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
log.critical("Can't open pid file %s: %s", args.pid, str(e))
|
log.critical("Can't open pid file %s: %s", pid, str(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if pid:
|
if pid:
|
||||||
|
@ -27,7 +27,6 @@ import re
|
|||||||
|
|
||||||
from pkg_resources import parse_version
|
from pkg_resources import parse_version
|
||||||
from gns3server.utils.asyncio import wait_for_process_termination
|
from gns3server.utils.asyncio import wait_for_process_termination
|
||||||
from gns3server.utils.asyncio import monitor_process
|
|
||||||
from gns3server.utils.asyncio import subprocess_check_output
|
from gns3server.utils.asyncio import subprocess_check_output
|
||||||
from .ubridge_hypervisor import UBridgeHypervisor
|
from .ubridge_hypervisor import UBridgeHypervisor
|
||||||
from .ubridge_error import UbridgeError
|
from .ubridge_error import UbridgeError
|
||||||
@ -152,7 +151,6 @@ class Hypervisor(UBridgeHypervisor):
|
|||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
cwd=self._working_dir)
|
cwd=self._working_dir)
|
||||||
|
|
||||||
#monitor_process(self._process, self._termination_callback)
|
|
||||||
log.info("ubridge started PID={}".format(self._process.pid))
|
log.info("ubridge started PID={}".format(self._process.pid))
|
||||||
except (OSError, subprocess.SubprocessError) as e:
|
except (OSError, subprocess.SubprocessError) as e:
|
||||||
ubridge_stdout = self.read_stdout()
|
ubridge_stdout = self.read_stdout()
|
||||||
|
@ -49,16 +49,6 @@ def base_params(tmpdir, fake_qemu_bin):
|
|||||||
return {"name": "PC TEST 1", "qemu_path": fake_qemu_bin}
|
return {"name": "PC TEST 1", "qemu_path": fake_qemu_bin}
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def fake_qemu_bin():
|
|
||||||
|
|
||||||
bin_path = os.path.join(os.environ["PATH"], "qemu-system-x86_64")
|
|
||||||
with open(bin_path, "w+") as f:
|
|
||||||
f.write("1")
|
|
||||||
os.chmod(bin_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
|
||||||
return bin_path
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def vm(server, project, base_params):
|
def vm(server, project, base_params):
|
||||||
response = server.post("/projects/{project_id}/qemu/vms".format(project_id=project.id), base_params)
|
response = server.post("/projects/{project_id}/qemu/vms".format(project_id=project.id), base_params)
|
||||||
|
@ -90,25 +90,6 @@ def test_set(tmpdir):
|
|||||||
assert dict(config.get_section_config("Server")) == {"host": "192.168.1.1"}
|
assert dict(config.get_section_config("Server")) == {"host": "192.168.1.1"}
|
||||||
|
|
||||||
|
|
||||||
def test_reload(tmpdir):
|
|
||||||
|
|
||||||
config = load_config(tmpdir, {
|
|
||||||
"Server": {
|
|
||||||
"host": "127.0.0.1"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
assert dict(config.get_section_config("Server")) == {"host": "127.0.0.1"}
|
|
||||||
|
|
||||||
path = write_config(tmpdir, {
|
|
||||||
"Server": {
|
|
||||||
"host": "192.168.1.1"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
config.reload()
|
|
||||||
assert dict(config.get_section_config("Server")) == {"host": "192.168.1.1"}
|
|
||||||
|
|
||||||
|
|
||||||
def test_reload(tmpdir):
|
def test_reload(tmpdir):
|
||||||
|
|
||||||
config = load_config(tmpdir, {
|
config = load_config(tmpdir, {
|
||||||
|
Loading…
Reference in New Issue
Block a user