Skip to content

Commit

Permalink
Use "experimental features" to allow bypassing hostname validation. Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Jul 8, 2024
1 parent d7bb195 commit d340b1f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gns3/graphics_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion gns3/modules/dynamips/pages/ios_router_configuration_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion gns3/modules/iou/pages/iou_device_configuration_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion gns3/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gns3/ui/general_preferences_page.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@
<item>
<widget class="QCheckBox" name="uiExperimentalFeaturesCheckBox">
<property name="text">
<string>Enable experimental features (dangerous, restart required)</string>
<string>Enable experimental features</string>
</property>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion gns3/ui/general_preferences_page_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit d340b1f

Please sign in to comment.