mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Find an alternative IOS or IOU image if one cannot be found when importing a topology.
This commit is contained in:
parent
551b98880b
commit
9fc7650f3f
@ -19,6 +19,7 @@
|
||||
Base class (interface) for modules
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
import gns3server.jsonrpc as jsonrpc
|
||||
@ -26,6 +27,7 @@ import multiprocessing
|
||||
import zmq
|
||||
import signal
|
||||
|
||||
from gns3server.config import Config
|
||||
from jsonschema import validate, ValidationError
|
||||
|
||||
import logging
|
||||
@ -45,6 +47,9 @@ class IModule(multiprocessing.Process):
|
||||
|
||||
def __init__(self, name, *args, **kwargs):
|
||||
|
||||
config = Config.instance()
|
||||
server_config = config.get_default_section()
|
||||
self._images_dir = os.path.expandvars(os.path.expanduser(server_config.get("upload_directory", "~/GNS3/images")))
|
||||
multiprocessing.Process.__init__(self, name=name)
|
||||
self._context = None
|
||||
self._ioloop = None
|
||||
@ -328,3 +333,8 @@ class IModule(multiprocessing.Process):
|
||||
cls.modules[module][destination] = method
|
||||
return method
|
||||
return wrapper
|
||||
|
||||
@property
|
||||
def images_directory(self):
|
||||
|
||||
return self._images_dir
|
||||
|
@ -138,6 +138,10 @@ class VM(object):
|
||||
chassis = request.get("chassis")
|
||||
router_id = request.get("router_id")
|
||||
|
||||
updated_image_path = os.path.join(self.images_directory, image)
|
||||
if os.path.isfile(updated_image_path):
|
||||
image = updated_image_path
|
||||
|
||||
try:
|
||||
|
||||
if platform not in PLATFORMS:
|
||||
|
@ -295,6 +295,10 @@ class IOU(IModule):
|
||||
console = request.get("console")
|
||||
iou_id = request.get("iou_id")
|
||||
|
||||
updated_iou_path = os.path.join(self.images_directory, iou_path)
|
||||
if os.path.isfile(updated_iou_path):
|
||||
iou_path = updated_iou_path
|
||||
|
||||
try:
|
||||
iou_instance = IOUDevice(name,
|
||||
iou_path,
|
||||
|
@ -23,5 +23,5 @@
|
||||
# or negative for a release candidate or beta (after the base version
|
||||
# number has been incremented)
|
||||
|
||||
__version__ = "1.0a8.dev1"
|
||||
__version__ = "1.0a8.dev2"
|
||||
__version_info__ = (1, 0, 0, -99)
|
||||
|
Loading…
Reference in New Issue
Block a user