Update node_exporter_manager.py

This commit is contained in:
gru
2025-06-07 23:49:18 +02:00
parent 0aa1af9750
commit fcd2120d01

View File

@ -63,6 +63,9 @@ def download_and_extract(url, download_path='/tmp'):
import sys
filename = os.path.join(download_path, url.split('/')[-1])
extract_dirname = filename.replace('.tar.gz', '')
extract_path = Path(extract_dirname)
try:
with requests.get(url, stream=True, timeout=30) as r:
r.raise_for_status()
@ -79,7 +82,11 @@ def download_and_extract(url, download_path='/tmp'):
else:
tar.extractall(path=download_path)
return next(Path(download_path).glob('node_exporter-*'))
if not extract_path.is_dir():
raise Exception(f"Nie znaleziono rozpakowanego katalogu: {extract_path}")
return extract_path
# ----------------- INSTALACJA I KONFIGURACJA -----------------