Skip to content

Commit

Permalink
Merge pull request #3503 from GNS3/release-v2.2.42
Browse files Browse the repository at this point in the history
Release v2.2.42
  • Loading branch information
grossmj authored Aug 9, 2023
2 parents aa9b9d3 + 3527e55 commit 7512ffe
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 33 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 2.2.42 09/08/2023

* Use the system's certificate store for SSL connections
* Give a node some time to start before opening the console (for console auto start). Fixes #3474
* Use Mate Terminal by default if installed on Debian, Ubuntu and Linux Mint.
* Support for gnome-terminal tabs to be opened in the same window.
* Remove import urllib3 and let sentry_sdk import and patch it. Fixes https://github.com/GNS3/gns3-gui/issues/3498
* Add import sys in sudo.py
* Rounded Rectangle support

## 2.2.41 12/07/2023

* Use alternative method to set the correct permissions for uBridge on macOS
Expand Down
28 changes: 8 additions & 20 deletions gns3/crash_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys
import os
import platform
import struct
import distro
import urllib3

try:
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
Expand All @@ -30,7 +23,12 @@
# Sentry SDK is not installed with deb package in order to simplify packaging
SENTRY_SDK_AVAILABLE = False

from .utils.get_resource import get_resource
import sys
import os
import platform
import struct
import distro

from .version import __version__, __version_info__

import logging
Expand All @@ -52,7 +50,7 @@ class CrashReport:
Report crash to a third party service
"""

DSN = "https://8e73913aea164a31a72e3a07fc455e26@o19455.ingest.sentry.io/38506"
DSN = "https://bae0411a1718612ee8c25cdb12ec7f02@o19455.ingest.sentry.io/38506"
_instance = None

def __init__(self):
Expand All @@ -65,24 +63,14 @@ def __init__(self):
self._sentry_initialized = False

if SENTRY_SDK_AVAILABLE:
cacert = None
if hasattr(sys, "frozen"):
cacert_resource = get_resource("cacert.pem")
if cacert_resource is not None and os.path.isfile(cacert_resource):
cacert = cacert_resource
else:
log.error("The SSL certificate bundle file '{}' could not be found".format(cacert_resource))

# Don't send log records as events.
sentry_logging = LoggingIntegration(level=logging.INFO, event_level=None)

try:
sentry_sdk.init(dsn=CrashReport.DSN,
release=__version__,
ca_certs=cacert,
default_integrations=False,
integrations=[sentry_logging])
except urllib3.exceptions.HTTPError as e:
except Exception as e:
log.error("Crash report could not be sent: {}".format(e))
return

Expand Down
11 changes: 9 additions & 2 deletions gns3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
from gns3.application import Application
from gns3.utils import parse_version
from gns3.dialogs.profile_select import ProfileSelectDialog
from gns3.version import __version__


import logging
log = logging.getLogger(__name__)

from gns3.version import __version__


def locale_check():
"""
Expand Down Expand Up @@ -135,6 +135,13 @@ def main():
if options.project:
options.project = os.path.abspath(options.project)

try:
import truststore
truststore.inject_into_ssl()
log.info("Using system certificate store for SSL connections")
except ImportError:
pass

if hasattr(sys, "frozen"):
# We add to the path where the OS search executable our binary location starting by GNS3
# packaged binary
Expand Down
3 changes: 2 additions & 1 deletion gns3/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ def setStatus(self, status):
return
super().setStatus(status)
if status == self.started and "console_auto_start" in self.settings() and self.settings()["console_auto_start"]:
self.openConsole()
# give the node some time to start before opening the console
QtCore.QTimer.singleShot(1000, self.openConsole)

def openConsole(self, command=None, aux=False):
"""
Expand Down
1 change: 1 addition & 0 deletions gns3/registry/appliance_to_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ..controller import Controller
from .config import Config, ConfigException


import logging
log = logging.getLogger(__name__)

Expand Down
9 changes: 6 additions & 3 deletions gns3/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@
else:
PRECONFIGURED_TELNET_CONSOLE_COMMANDS = {'Xterm': 'xterm -T "%d" -e "telnet %h %p"',
'Putty': 'putty -telnet %h %p -title "%d" -sl 2500 -fg SALMON1 -bg BLACK',
'Gnome Terminal': 'gnome-terminal -t "%d" -e "telnet %h %p"',
'Gnome Terminal': 'gnome-terminal --tab -t "%d" -- telnet %h %p',
'Xfce4 Terminal': 'xfce4-terminal --tab -T "%d" -e "telnet %h %p"',
'ROXTerm': 'roxterm -n "%d" --tab -e "telnet %h %p"',
'KDE Konsole': 'konsole --new-tab -p tabtitle="%d" -e "telnet %h %p"',
'SecureCRT': 'SecureCRT /T /N "%d" /TELNET %h %p',
'Mate Terminal': 'mate-terminal --tab -e "telnet %h %p" -t "%d"',
'Mate Terminal': 'mate-terminal --tab -e "telnet %h %p" -t "%d"',
'terminator': 'terminator -e "telnet %h %p" -T "%d"',
'urxvt': 'urxvt -title %d -e telnet %h %p',
'kitty': 'kitty -T %d telnet %h %p'}
Expand All @@ -168,7 +168,10 @@
if sys.platform.startswith("linux"):
distro_name = distro.name()
if distro_name == "Debian" or distro_name == "Ubuntu" or distro_name == "LinuxMint":
DEFAULT_TELNET_CONSOLE_COMMAND = PRECONFIGURED_TELNET_CONSOLE_COMMANDS["Gnome Terminal"]
if shutil.which("mate-terminal"):
DEFAULT_TELNET_CONSOLE_COMMAND = PRECONFIGURED_TELNET_CONSOLE_COMMANDS["Mate Terminal"]
else:
DEFAULT_TELNET_CONSOLE_COMMAND = PRECONFIGURED_TELNET_CONSOLE_COMMANDS["Gnome Terminal"]

# Pre-configured VNC console commands on various OSes
if sys.platform.startswith("win"):
Expand Down
44 changes: 43 additions & 1 deletion gns3/telnet_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import sys
import shlex
import subprocess
import psutil

from .main_window import MainWindow
from .controller import Controller

Expand All @@ -34,6 +36,39 @@
console_mutex = QtCore.QMutex()


def gnome_terminal_env():

uid = os.getuid()

# get list of processes of current user
procs = [p.info for p in psutil.process_iter(
attrs=['name', 'pid', 'ppid', 'create_time', 'uids']
) if p.info['uids'].real == uid]

# get pid of gnome-terminal-server process
gnome_terminal_server_pid = [p['pid'] for p in procs if p['name'] == "gnome-terminal-server"]
if not gnome_terminal_server_pid:
return {}
gnome_terminal_server_pid = gnome_terminal_server_pid[0]

# get subprocesses of gnome-terminal-server
gnome_terminal_server_children = [p for p in procs if p['ppid'] == gnome_terminal_server_pid]
gnome_terminal_server_children.sort(key=lambda p: p['create_time'], reverse=True)

# return the gnome-terminal environment variables of the first subprocess named telnet
for proc in gnome_terminal_server_children:
if proc['name'] == "telnet":
try:
env = psutil.Process(proc['pid']).environ()
if 'GNOME_TERMINAL_SERVICE' in env and \
'GNOME_TERMINAL_SCREEN' in env:
return {'GNOME_TERMINAL_SERVICE': env['GNOME_TERMINAL_SERVICE'],
'GNOME_TERMINAL_SCREEN': env['GNOME_TERMINAL_SCREEN']}
except psutil.Error:
pass
return {}


class ConsoleThread(QtCore.QThread):

consoleError = QtCore.pyqtSignal(str)
Expand All @@ -60,7 +95,14 @@ def exec_command(self, command):
except ValueError:
self.consoleError.emit("Syntax error in command: '{}'".format(command))
return
subprocess.call(args, env=os.environ)

env = os.environ.copy()
# special case to force gnome-terminal to correctly use tabs on Linux
if sys.platform.startswith("linux") and "gnome-terminal" in args[0] and "--tab" in command:
# inject gnome-terminal environment variables
if "GNOME_TERMINAL_SERVICE" not in env or "GNOME_TERMINAL_SCREEN" not in env:
env.update(gnome_terminal_env())
subprocess.call(args, env=env)

def run(self):

Expand Down
1 change: 0 additions & 1 deletion gns3/update_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


from gns3.utils import parse_version

from gns3 import version
from gns3.qt import QtNetwork, QtCore, QtWidgets, QtGui, qslot
from gns3.local_config import LocalConfig
Expand Down
5 changes: 2 additions & 3 deletions gns3/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
# or negative for a release candidate or beta (after the base version
# number has been incremented)

__version__ = "2.2.41"
__version_info__ = (2, 2, 41, 0)

__version__ = "2.2.42"
__version_info__ = (2, 2, 42, 0)
if "dev" in __version__:
try:
import os
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
jsonschema>=4.17.3,<4.18; python_version >= '3.7'
jsonschema==3.2.0; python_version < '3.7' # v3.2.0 is the last version to support Python 3.6
sentry-sdk==1.17.0,<1.18
psutil==5.9.4
sentry-sdk==1.29.2,<1.30
psutil==5.9.5
distro>=1.8.0
truststore>=0.7.0; python_version >= '3.10'
setuptools>=60.8.1; python_version >= '3.7'
setuptools==59.6.0; python_version < '3.7' # v59.6.0 is the last version to support Python 3.6

0 comments on commit 7512ffe

Please sign in to comment.