From 5274339774a06d2060e234b4faccc0149d2bceab Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 30 Dec 2024 14:19:26 +0100 Subject: [PATCH] Browser do not working --- README.rst | 2 +- docker-files/alpine.Dockerfile | 5 +---- glances/plugins/ip/__init__.py | 4 ++-- glances/ports_list.py | 2 +- glances/servers_list_dynamic.py | 2 +- optional-requirements.txt | 2 +- pyproject.toml | 2 +- 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 4e7a5f56..be3fb5fb 100644 --- a/README.rst +++ b/README.rst @@ -112,7 +112,7 @@ Optional dependencies: - ``influxdb-client`` (for the InfluxDB version 2 export module) - ``jinja2`` (for templating, used under the hood by FastAPI) - ``kafka-python`` (for the Kafka export module) -- ``netifaces-plus`` (for the IP plugin) +- ``netifaces2`` (for the IP plugin) - ``nvidia-ml-py`` (for the GPU plugin) - ``pycouchdb`` (for the CouchDB export module) - ``pika`` (for the RabbitMQ/ActiveMQ export module) diff --git a/docker-files/alpine.Dockerfile b/docker-files/alpine.Dockerfile index 6d17ee82..2c1413ca 100644 --- a/docker-files/alpine.Dockerfile +++ b/docker-files/alpine.Dockerfile @@ -9,10 +9,7 @@ # WARNING: the Alpine image version and Python version should be set. # Alpine 3.18 tag is a link to the latest 3.18.x version. # Be aware that if you change the Alpine version, you may have to change the Python version. - -# Netifaces (and Netifaces-plus) are not compliant with GCC embeded in Alpine 3.21 -# See: https://github.com/tsukumijima/netifaces-plus/issues/9 -ARG IMAGE_VERSION=3.20 +ARG IMAGE_VERSION=3.21 ARG PYTHON_VERSION=3.12 ############################################################################## diff --git a/glances/plugins/ip/__init__.py b/glances/plugins/ip/__init__.py index 23bbb06c..dab7c91a 100644 --- a/glances/plugins/ip/__init__.py +++ b/glances/plugins/ip/__init__.py @@ -88,7 +88,7 @@ class PluginModel(GlancesPluginModel): def get_private_ip(self, stats, stop=False): # Get the default gateway thanks to the netifaces lib try: - default_gw = netifaces.gateways()['default'][netifaces.AF_INET] + default_gw = netifaces.gateways()[netifaces.AF_INET][0] except (KeyError, AttributeError) as e: logger.debug(f"Cannot grab default gateway IP address ({e})") stop = True @@ -99,7 +99,7 @@ class PluginModel(GlancesPluginModel): def get_first_ip(self, stats, stop=False): try: - default_gw = netifaces.gateways()['default'][netifaces.AF_INET] + default_gw = netifaces.gateways()[netifaces.AF_INET][0] address = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['addr'] mask = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['netmask'] except (KeyError, AttributeError) as e: diff --git a/glances/ports_list.py b/glances/ports_list.py index 32b85bfb..8d3cedb8 100644 --- a/glances/ports_list.py +++ b/glances/ports_list.py @@ -50,7 +50,7 @@ class GlancesPortsList: if default_gateway.lower().startswith('true') and netifaces_tag: new_port = {} try: - new_port['host'] = netifaces.gateways()['default'][netifaces.AF_INET][0] + new_port['host'] = netifaces.gateways()[netifaces.AF_INET][0][0] except KeyError: new_port['host'] = None # ICMP diff --git a/glances/servers_list_dynamic.py b/glances/servers_list_dynamic.py index 12e176da..a56de850 100644 --- a/glances/servers_list_dynamic.py +++ b/glances/servers_list_dynamic.py @@ -244,7 +244,7 @@ class GlancesAutoDiscoverClient: import netifaces # Interface of the default gateway - gateway_itf = netifaces.gateways()['default'][netifaces.AF_INET][1] + gateway_itf = netifaces.gateways()[netifaces.AF_INET][0][1] # IP address for the interface return netifaces.ifaddresses(gateway_itf)[netifaces.AF_INET][0]['addr'] diff --git a/optional-requirements.txt b/optional-requirements.txt index 415d50e9..dc3fc345 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -14,7 +14,7 @@ influxdb>=1.0.0 # For InfluxDB < 1.8 influxdb-client # For InfluxDB >= 1.8 jinja2 kafka-python -netifaces-plus +netifaces2 nvidia-ml-py orjson paho-mqtt diff --git a/pyproject.toml b/pyproject.toml index 80c387c6..e15ef252 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,7 +84,7 @@ export = [ ] gpu = ["nvidia-ml-py"] graph = ["pygal"] -ip = ["netifaces-plus"] +ip = ["netifaces2"] raid = ["pymdstat"] sensors = ["batinfo; platform_system == 'Linux'"] smart = ["pySMART.smartx"]