Update node_exporter_manager.py
This commit is contained in:
@@ -60,6 +60,8 @@ def get_local_version():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def download_and_extract(url, download_path='/tmp'):
|
def download_and_extract(url, download_path='/tmp'):
|
||||||
|
import sys
|
||||||
|
|
||||||
filename = os.path.join(download_path, url.split('/')[-1])
|
filename = os.path.join(download_path, url.split('/')[-1])
|
||||||
try:
|
try:
|
||||||
with requests.get(url, stream=True, timeout=30) as r:
|
with requests.get(url, stream=True, timeout=30) as r:
|
||||||
@@ -72,7 +74,11 @@ def download_and_extract(url, download_path='/tmp'):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
with tarfile.open(filename) as tar:
|
with tarfile.open(filename) as tar:
|
||||||
|
if sys.version_info >= (3, 12):
|
||||||
tar.extractall(path=download_path, filter='data')
|
tar.extractall(path=download_path, filter='data')
|
||||||
|
else:
|
||||||
|
tar.extractall(path=download_path)
|
||||||
|
|
||||||
return next(Path(download_path).glob('node_exporter-*'))
|
return next(Path(download_path).glob('node_exporter-*'))
|
||||||
|
|
||||||
# ----------------- INSTALACJA I KONFIGURACJA -----------------
|
# ----------------- INSTALACJA I KONFIGURACJA -----------------
|
||||||
|
Reference in New Issue
Block a user