mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-03-14 01:23:35 +02:00
Make gns3server.appliances a package
This commit is contained in:
parent
b8d595928b
commit
5bcc247881
0
gns3server/appliances/__init__.py
Normal file
0
gns3server/appliances/__init__.py
Normal file
@ -41,7 +41,6 @@ from ..version import __version__
|
|||||||
from .topology import load_topology
|
from .topology import load_topology
|
||||||
from .gns3vm import GNS3VM
|
from .gns3vm import GNS3VM
|
||||||
from .gns3vm.gns3_vm_error import GNS3VMError
|
from .gns3vm.gns3_vm_error import GNS3VMError
|
||||||
from gns3server import configs as gns3_configs
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -289,10 +288,9 @@ class Controller:
|
|||||||
if not os.path.exists(os.path.join(dst_path, filename)):
|
if not os.path.exists(os.path.join(dst_path, filename)):
|
||||||
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
|
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
|
||||||
else:
|
else:
|
||||||
for entry in importlib_resources.files(gns3_configs).iterdir():
|
for entry in importlib_resources.files('gns3server.configs').iterdir():
|
||||||
if entry.is_file():
|
|
||||||
full_path = os.path.join(dst_path, entry.name)
|
full_path = os.path.join(dst_path, entry.name)
|
||||||
if not os.path.exists(full_path):
|
if entry.is_file() and not os.path.exists(full_path):
|
||||||
log.debug(f"Installing base config file {entry.name} to {full_path}")
|
log.debug(f"Installing base config file {entry.name} to {full_path}")
|
||||||
shutil.copy(str(entry), os.path.join(dst_path, entry.name))
|
shutil.copy(str(entry), os.path.join(dst_path, entry.name))
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
@ -32,7 +32,6 @@ except ImportError:
|
|||||||
from .appliance import Appliance
|
from .appliance import Appliance
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..utils.asyncio import locking
|
from ..utils.asyncio import locking
|
||||||
from gns3server import appliances as gns3_appliances
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -105,10 +104,9 @@ class ApplianceManager:
|
|||||||
if not os.path.exists(os.path.join(dst_path, filename)):
|
if not os.path.exists(os.path.join(dst_path, filename)):
|
||||||
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
|
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
|
||||||
else:
|
else:
|
||||||
for entry in importlib_resources.files(gns3_appliances).iterdir():
|
for entry in importlib_resources.files('gns3server.appliances').iterdir():
|
||||||
if entry.is_file():
|
|
||||||
full_path = os.path.join(dst_path, entry.name)
|
full_path = os.path.join(dst_path, entry.name)
|
||||||
if not os.path.exists(full_path):
|
if entry.is_file() and not os.path.exists(full_path):
|
||||||
log.debug(f"Installing built-in appliance file {entry.name} to {full_path}")
|
log.debug(f"Installing built-in appliance file {entry.name} to {full_path}")
|
||||||
shutil.copy(str(entry), os.path.join(dst_path, entry.name))
|
shutil.copy(str(entry), os.path.join(dst_path, entry.name))
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user