From d340b1f50a13f9fed7d604c43f4f8451205bcdb4 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 8 Jul 2024 14:19:42 +0200 Subject: [PATCH] Use "experimental features" to allow bypassing hostname validation. Ref #3524 --- gns3/graphics_view.py | 2 +- gns3/modules/dynamips/pages/ios_router_configuration_page.py | 3 ++- gns3/modules/iou/pages/iou_device_configuration_page.py | 3 ++- gns3/settings.py | 1 - gns3/ui/general_preferences_page.ui | 2 +- gns3/ui/general_preferences_page_ui.py | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gns3/graphics_view.py b/gns3/graphics_view.py index 668ea8451..6481a6c6e 100644 --- a/gns3/graphics_view.py +++ b/gns3/graphics_view.py @@ -1032,7 +1032,7 @@ def changeHostnameActionSlot(self): if not new_hostname.strip(): QtWidgets.QMessageBox.critical(self, "Change hostname", "Hostname cannot be blank") continue - if hasattr(item.node(), "validateHostname"): + if hasattr(item.node(), "validateHostname") and not LocalConfig.instance().experimental(): if not item.node().validateHostname(new_hostname): QtWidgets.QMessageBox.critical(self, "Change hostname", "Invalid name detected for this node: {}".format(new_hostname)) continue diff --git a/gns3/modules/dynamips/pages/ios_router_configuration_page.py b/gns3/modules/dynamips/pages/ios_router_configuration_page.py index 112d15bd5..12fccab6f 100644 --- a/gns3/modules/dynamips/pages/ios_router_configuration_page.py +++ b/gns3/modules/dynamips/pages/ios_router_configuration_page.py @@ -24,6 +24,7 @@ from gns3.qt import QtCore, QtGui, QtWidgets from gns3.local_server import LocalServer +from gns3.local_config import LocalConfig from gns3.dialogs.node_properties_dialog import ConfigurationError from gns3.dialogs.symbol_selection_dialog import SymbolSelectionDialog from gns3.controller import Controller @@ -488,7 +489,7 @@ def saveSettings(self, settings, node=None, group=False): name = self.uiNameLineEdit.text() if not name: QtWidgets.QMessageBox.critical(self, "Name", "IOS router name cannot be empty!") - elif node and not node.validateHostname(name): + elif node and not node.validateHostname(name) and not LocalConfig.instance().experimental(): QtWidgets.QMessageBox.critical(self, "Name", "Invalid name detected for IOS router: {}".format(name)) else: settings["name"] = name diff --git a/gns3/modules/iou/pages/iou_device_configuration_page.py b/gns3/modules/iou/pages/iou_device_configuration_page.py index 4a712056d..eee9a94ca 100644 --- a/gns3/modules/iou/pages/iou_device_configuration_page.py +++ b/gns3/modules/iou/pages/iou_device_configuration_page.py @@ -23,6 +23,7 @@ from gns3.qt import QtWidgets from gns3.local_server import LocalServer +from gns3.local_config import LocalConfig from gns3.dialogs.node_properties_dialog import ConfigurationError from gns3.dialogs.symbol_selection_dialog import SymbolSelectionDialog from gns3.node import Node @@ -245,7 +246,7 @@ def saveSettings(self, settings, node=None, group=False): name = self.uiNameLineEdit.text() if not name: QtWidgets.QMessageBox.critical(self, "Name", "IOU device name cannot be empty!") - elif node and not node.validateHostname(name): + elif node and not node.validateHostname(name) and not LocalConfig.instance().experimental(): QtWidgets.QMessageBox.critical(self, "Name", "Invalid name detected for IOU device: {}".format(name)) else: settings["name"] = name diff --git a/gns3/settings.py b/gns3/settings.py index 47fecb3d2..2ec438dfa 100644 --- a/gns3/settings.py +++ b/gns3/settings.py @@ -287,7 +287,6 @@ "check_for_update": True, "overlay_notifications": True, "experimental_features": False, - "stats_visitor_id": str(uuid.uuid4()), # An anonymous id for stats "last_check_for_update": 0, "telnet_console_command": DEFAULT_TELNET_CONSOLE_COMMAND, "vnc_console_command": DEFAULT_VNC_CONSOLE_COMMAND, diff --git a/gns3/ui/general_preferences_page.ui b/gns3/ui/general_preferences_page.ui index f5ec5ab69..b7226e3d8 100755 --- a/gns3/ui/general_preferences_page.ui +++ b/gns3/ui/general_preferences_page.ui @@ -1012,7 +1012,7 @@ - Enable experimental features (dangerous, restart required) + Enable experimental features diff --git a/gns3/ui/general_preferences_page_ui.py b/gns3/ui/general_preferences_page_ui.py index fc3bd1a0b..c6f2fb2d8 100644 --- a/gns3/ui/general_preferences_page_ui.py +++ b/gns3/ui/general_preferences_page_ui.py @@ -598,7 +598,7 @@ def retranslateUi(self, GeneralPreferencesPageWidget): self.uiCheckForUpdateCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Automatically check for update")) self.uiCrashReportCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Send anonymous crash reports")) self.uiOverlayNotificationsCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Display error, warning and info in an overlay popup")) - self.uiExperimentalFeaturesCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Enable experimental features (dangerous, restart required)")) + self.uiExperimentalFeaturesCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Enable experimental features")) self.uiHdpiCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Enable HDPI mode (this may crash on Linux, restart required)")) self.uiMultiProfilesCheckBox.setText(_translate("GeneralPreferencesPageWidget", "Request for profile settings at application startup")) self.uiDirectFileUpload.setToolTip(_translate("GeneralPreferencesPageWidget", "Experimental, requires computes visibility from GUI network"))