1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jeremy 2015-05-13 15:54:03 -06:00
commit 2531a05adc
4 changed files with 61 additions and 4 deletions

View File

@ -16,6 +16,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# WARNING
# Due to buggy user machines we choose to put this as the first loading modules
# otherwise the egg cache is initialized in his standard location and
# if is not writetable the application crash. It's the user fault
# because one day the user as used sudo to run an egg and break his
# filesystem permissions, but it's a common mistake.
import gns3server.utils.get_resource
import os import os
import datetime import datetime
import sys import sys

View File

@ -433,7 +433,10 @@ class IOUVM(BaseVM):
yield from self._library_check() yield from self._library_check()
self._rename_nvram_file() try:
self._rename_nvram_file()
except OSError as e:
raise IOUError("Could not rename nvram files: {}".format(e))
iourc_path = self.iourc_path iourc_path = self.iourc_path
if iourc_path is None: if iourc_path is None:

View File

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import tempfile
import pkg_resources
import atexit
import logging
log = logging.getLogger(__name__)
try:
egg_cache_dir = tempfile.mkdtemp()
pkg_resources.set_extraction_path(egg_cache_dir)
except ValueError:
# If the path is already set the module throw an error
pass
@atexit.register
def clean_egg_cache():
try:
import shutil
log.debug("Clean egg cache %s", egg_cache_dir)
shutil.rmtree(egg_cache_dir)
except Exception:
# We don't care if we can not cleanup
pass

View File

@ -272,12 +272,13 @@ def test_build_command(vm, loop, fake_qemu_binary, port_manager):
os.path.join(vm.working_dir, "flash.qcow2"), os.path.join(vm.working_dir, "flash.qcow2"),
"-serial", "-serial",
"telnet:127.0.0.1:{},server,nowait".format(vm.console), "telnet:127.0.0.1:{},server,nowait".format(vm.console),
"-net",
"none",
"-device", "-device",
"e1000,mac=00:00:ab:0e:0f:00,netdev=gns3-0", "e1000,mac=00:00:ab:0e:0f:00"
"-netdev",
"user,id=gns3-0"
] ]
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_build_command_without_display(vm, loop, fake_qemu_binary): def test_build_command_without_display(vm, loop, fake_qemu_binary):
@ -313,6 +314,7 @@ def test_hdb_disk_image(vm, tmpdir):
vm.hdb_disk_image = "test" vm.hdb_disk_image = "test"
assert vm.hdb_disk_image == str(tmpdir / "QEMU" / "test") assert vm.hdb_disk_image == str(tmpdir / "QEMU" / "test")
def test_hdc_disk_image(vm, tmpdir): def test_hdc_disk_image(vm, tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}): with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}):
@ -321,6 +323,7 @@ def test_hdc_disk_image(vm, tmpdir):
vm.hdc_disk_image = "test" vm.hdc_disk_image = "test"
assert vm.hdc_disk_image == str(tmpdir / "QEMU" / "test") assert vm.hdc_disk_image == str(tmpdir / "QEMU" / "test")
def test_hdd_disk_image(vm, tmpdir): def test_hdd_disk_image(vm, tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}): with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}):