Update 2025-12-19 20:23:59

This commit is contained in:
unknown
2025-12-19 20:23:59 +09:00
parent b37c43ab86
commit 9d5d2b8d99
22 changed files with 1302 additions and 472 deletions

View File

@@ -3,9 +3,17 @@ import re
import subprocess
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor, as_completed
import logging
from dotenv import load_dotenv, find_dotenv
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [INFO] root: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
# ─────────────────────────────────────────────────────────────
# .env 자동 탐색 로드 (현재 파일 기준 상위 디렉터리까지 검색)
load_dotenv(find_dotenv())
@@ -86,7 +94,7 @@ def fetch_idrac_info(idrac_ip: str, output_dir: Path) -> None:
svc_tag = svc_tag_match.group(1) if svc_tag_match else None
if not svc_tag:
print(f"Failed to retrieve SVC Tag for IP: {idrac_ip}")
logging.error(f"Failed to retrieve SVC Tag for IP: {idrac_ip}")
return
# 전체 하드웨어 인벤토리
@@ -125,13 +133,13 @@ def fetch_idrac_info(idrac_ip: str, output_dir: Path) -> None:
f.write(f"SERIALS: {';'.join(serials_only)}\n")
except Exception as e:
print(f"Error processing IP {idrac_ip}: {e}")
logging.error(f"Error processing IP {idrac_ip}: {e}")
def main(ip_file: str) -> None:
ip_path = Path(ip_file)
if not ip_path.is_file():
print(f"IP file {ip_file} does not exist.")
logging.error(f"IP file {ip_file} does not exist.")
return
output_dir = resolve_output_dir()
@@ -146,14 +154,14 @@ def main(ip_file: str) -> None:
ip = future_to_ip[future]
try:
future.result()
print(f"✅ Completed: {ip}")
logging.info(f"✅ Completed: {ip}")
except Exception as e:
print(f"❌ Error processing {ip}: {e}")
logging.error(f"❌ Error processing {ip}: {e}")
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print("Usage: python GPU_Serial_v1.py <ip_file>")
logging.error("Usage: python GPU_Serial_v1.py <ip_file>")
sys.exit(1)
main(sys.argv[1])