mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7e8b0a48ab
107 files changed
+728
-227
No files matched your search
@@ -16,6 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
from .vpcs import VPCS
|
||||
from .virtualbox import VirtualBox
|
||||
from .dynamips import Dynamips
|
||||
@@ -23,7 +24,7 @@ from .qemu import Qemu
|
||||
|
||||
MODULES = [VPCS, VirtualBox, Dynamips, Qemu]
|
||||
|
||||
if sys.platform.startswith("linux") or hasattr(sys, "_called_from_test"):
|
||||
if sys.platform.startswith("linux") or hasattr(sys, "_called_from_test") or os.environ.get("PYTEST_BUILD_DOCUMENTATION") == "1":
|
||||
# IOU runs only on Linux
|
||||
from .iou import IOU
|
||||
MODULES.append(IOU)
|
||||
@@ -153,6 +153,16 @@ class IOUVM(BaseVM):
|
||||
path = relative_path
|
||||
|
||||
self._path = path
|
||||
|
||||
# In 1.2 users uploaded images to the images roots
|
||||
# after the migration their images are inside images/IOU
|
||||
# but old topologies use old path
|
||||
if "IOU" not in self._path:
|
||||
location, filename = os.path.split(self._path)
|
||||
fix_path = os.path.join(location, "IOU", filename)
|
||||
if os.path.isfile(fix_path):
|
||||
self._path = fix_path
|
||||
|
||||
if not os.path.isfile(self._path) or not os.path.exists(self._path):
|
||||
if os.path.islink(self._path):
|
||||
raise IOUError("IOU image '{}' linked to '{}' is not accessible".format(self._path, os.path.realpath(self._path)))
|
||||
@@ -985,8 +995,13 @@ class IOUVM(BaseVM):
|
||||
|
||||
try:
|
||||
script_file = os.path.join(self.working_dir, "initial-config.cfg")
|
||||
|
||||
# We disallow erasing the initial config file
|
||||
if len(initial_config) == 0 and os.path.exists(script_file):
|
||||
return
|
||||
|
||||
with open(script_file, 'w+') as f:
|
||||
if initial_config is None:
|
||||
if len(initial_config) == 0:
|
||||
f.write('')
|
||||
else:
|
||||
initial_config = initial_config.replace("%h", self._name)
|
||||
|
||||
Reference in new issue
Block a user