From 0aa1af9750d34d9e27c957d0331a3b860606019a Mon Sep 17 00:00:00 2001 From: gru Date: Sat, 7 Jun 2025 23:28:18 +0200 Subject: [PATCH] Update node_exporter_manager.py --- node_exporter_manager.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node_exporter_manager.py b/node_exporter_manager.py index 99e7648..ef8f6b2 100644 --- a/node_exporter_manager.py +++ b/node_exporter_manager.py @@ -60,6 +60,8 @@ def get_local_version(): return None def download_and_extract(url, download_path='/tmp'): + import sys + filename = os.path.join(download_path, url.split('/')[-1]) try: with requests.get(url, stream=True, timeout=30) as r: @@ -72,7 +74,11 @@ def download_and_extract(url, download_path='/tmp'): raise with tarfile.open(filename) as tar: - tar.extractall(path=download_path, filter='data') + if sys.version_info >= (3, 12): + tar.extractall(path=download_path, filter='data') + else: + tar.extractall(path=download_path) + return next(Path(download_path).glob('node_exporter-*')) # ----------------- INSTALACJA I KONFIGURACJA -----------------