mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-30 20:28:08 +00:00
Fixes incompatibility for IOS startup-config and private-config paths created on Windows and loaded from a project on Linux/Mac OS X.
This commit is contained in:
parent
e9991affc3
commit
d9f44edcaf
@ -16,7 +16,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import base64
|
||||
import ntpath
|
||||
import time
|
||||
from gns3server.modules import IModule
|
||||
@ -412,36 +411,38 @@ class VM(object):
|
||||
|
||||
response = {}
|
||||
try:
|
||||
startup_config_path = os.path.join(router.hypervisor.working_dir, "configs", "i{}_startup-config.cfg".format(router.id))
|
||||
private_config_path = os.path.join(router.hypervisor.working_dir, "configs", "i{}_private-config.cfg".format(router.id))
|
||||
default_startup_config_path = os.path.join(router.hypervisor.working_dir, "configs", "i{}_startup-config.cfg".format(router.id))
|
||||
default_private_config_path = os.path.join(router.hypervisor.working_dir, "configs", "i{}_private-config.cfg".format(router.id))
|
||||
|
||||
# a new startup-config has been pushed
|
||||
if "startup_config_base64" in request:
|
||||
# update the request with the new local startup-config path
|
||||
request["startup_config"] = self.create_config_from_base64(request["startup_config_base64"], router, startup_config_path)
|
||||
request["startup_config"] = self.create_config_from_base64(request["startup_config_base64"], router, default_startup_config_path)
|
||||
|
||||
# a new private-config has been pushed
|
||||
if "private_config_base64" in request:
|
||||
# update the request with the new local private-config path
|
||||
request["private_config"] = self.create_config_from_base64(request["private_config_base64"], router, private_config_path)
|
||||
request["private_config"] = self.create_config_from_base64(request["private_config_base64"], router, default_private_config_path)
|
||||
|
||||
if "startup_config" in request:
|
||||
if os.path.isfile(request["startup_config"]) and request["startup_config"] != startup_config_path:
|
||||
startup_config_path = request["startup_config"].replace("\\", '/')
|
||||
if os.path.isfile(startup_config_path) and startup_config_path != default_startup_config_path:
|
||||
# this is a local file set in the GUI
|
||||
request["startup_config"] = self.create_config_from_file(request["startup_config"], router, startup_config_path)
|
||||
router.set_config(request["startup_config"])
|
||||
startup_config_path = self.create_config_from_file(startup_config_path, router, default_startup_config_path)
|
||||
router.set_config(startup_config_path)
|
||||
else:
|
||||
router.set_config(request["startup_config"])
|
||||
response["startup_config"] = request["startup_config"]
|
||||
router.set_config(startup_config_path)
|
||||
response["startup_config"] = startup_config_path
|
||||
|
||||
if "private_config" in request:
|
||||
if os.path.isfile(request["private_config"]) and request["private_config"] != private_config_path:
|
||||
private_config_path = request["private_config"].replace("\\", '/')
|
||||
if os.path.isfile(private_config_path) and private_config_path != default_private_config_path:
|
||||
# this is a local file set in the GUI
|
||||
request["private_config"] = self.create_config_from_file(request["private_config"], router, private_config_path)
|
||||
router.set_config(router.startup_config, request["private_config"])
|
||||
private_config_path = self.create_config_from_file(private_config_path, router, default_private_config_path)
|
||||
router.set_config(router.startup_config, private_config_path)
|
||||
else:
|
||||
router.set_config(router.startup_config, request["private_config"])
|
||||
response["private_config"] = request["private_config"]
|
||||
router.set_config(router.startup_config, private_config_path)
|
||||
response["private_config"] = private_config_path
|
||||
|
||||
except DynamipsError as e:
|
||||
self.send_custom_error(str(e))
|
||||
|
@ -74,7 +74,7 @@ class Qemu(IModule):
|
||||
self._udp_end_port_range = qemu_config.get("udp_end_port_range", 45500)
|
||||
self._host = qemu_config.get("host", kwargs["host"])
|
||||
self._console_host = qemu_config.get("console_host", kwargs["console_host"])
|
||||
self._monitor_host = qemu_config.get("monitor_host", "0.0.0.0")
|
||||
self._monitor_host = qemu_config.get("monitor_host", "127.0.0.1")
|
||||
self._projects_dir = kwargs["projects_dir"]
|
||||
self._tempdir = kwargs["temp_dir"]
|
||||
self._working_dir = self._projects_dir
|
||||
|
Loading…
Reference in New Issue
Block a user