Update 2025-12-19 20:23:59
This commit is contained in:
@@ -3,6 +3,14 @@ import re
|
||||
import subprocess
|
||||
from dotenv import load_dotenv
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
import logging
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s [INFO] root: %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
|
||||
# .env 파일에서 사용자 이름 및 비밀번호 설정
|
||||
load_dotenv()
|
||||
@@ -18,7 +26,7 @@ def fetch_idrac_info(idrac_ip, output_dir):
|
||||
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
|
||||
|
||||
# InfiniBand.VndrConfigPage 목록 가져오기
|
||||
@@ -58,13 +66,15 @@ def fetch_idrac_info(idrac_ip, output_dir):
|
||||
# 모든 PortGUID를 "GUID: 0x<GUID1>;0x<GUID2>" 형식으로 저장
|
||||
if hex_guid_list:
|
||||
f.write(f"GUID: {';'.join(hex_guid_list)}\n")
|
||||
|
||||
logging.info(f"✅ Completed: {idrac_ip}")
|
||||
|
||||
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):
|
||||
if not os.path.isfile(ip_file):
|
||||
print(f"IP file {ip_file} does not exist.")
|
||||
logging.error(f"IP file {ip_file} does not exist.")
|
||||
return
|
||||
|
||||
output_dir = "/app/idrac_info/idrac_info"
|
||||
@@ -80,12 +90,12 @@ def main(ip_file):
|
||||
try:
|
||||
future.result()
|
||||
except Exception as e:
|
||||
print(f"Error processing task: {e}")
|
||||
logging.error(f"Error processing task: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <ip_file>")
|
||||
logging.error("Usage: python script.py <ip_file>")
|
||||
sys.exit(1)
|
||||
|
||||
ip_file = sys.argv[1]
|
||||
|
||||
Reference in New Issue
Block a user