优化日志输出
This commit is contained in:
parent
4940177a5b
commit
cafb0811b5
@ -442,7 +442,7 @@ def find_org(org_repo, using_cached: bool = False):
|
|||||||
|
|
||||||
# 1. 检测 SSH 配置
|
# 1. 检测 SSH 配置
|
||||||
ssh_available = _check_ssh_availability()
|
ssh_available = _check_ssh_availability()
|
||||||
print(f"SSH detection result: {ssh_available}")
|
print(f"SSH availability: {ssh_available}")
|
||||||
|
|
||||||
# 2. SSH 优先尝试
|
# 2. SSH 优先尝试
|
||||||
if ssh_available:
|
if ssh_available:
|
||||||
@ -453,7 +453,7 @@ def find_org(org_repo, using_cached: bool = False):
|
|||||||
return org, org_repo
|
return org, org_repo
|
||||||
|
|
||||||
# 3. HTTP 回退
|
# 3. HTTP 回退
|
||||||
print("Falling back to HTTP method...")
|
print("Try HTTP method...")
|
||||||
username, password = _get_http_credentials()
|
username, password = _get_http_credentials()
|
||||||
for org in ["jingrow", "jerp"]:
|
for org in ["jingrow", "jerp"]:
|
||||||
if _try_http_access(org, org_repo, username, password):
|
if _try_http_access(org, org_repo, username, password):
|
||||||
@ -474,7 +474,6 @@ def _check_ssh_availability():
|
|||||||
try:
|
try:
|
||||||
# 直接测试 SSH 连接(使用配置的端口)
|
# 直接测试 SSH 连接(使用配置的端口)
|
||||||
ssh_cmd = ['ssh', '-p', str(GIT_SSH_PORT), '-T', f'{GIT_SSH_USER}@{GIT_SSH_HOST}']
|
ssh_cmd = ['ssh', '-p', str(GIT_SSH_PORT), '-T', f'{GIT_SSH_USER}@{GIT_SSH_HOST}']
|
||||||
print(f"SSH connection test command: {' '.join(ssh_cmd)}")
|
|
||||||
|
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
ssh_cmd,
|
ssh_cmd,
|
||||||
@ -482,14 +481,11 @@ def _check_ssh_availability():
|
|||||||
text=True,
|
text=True,
|
||||||
timeout=10
|
timeout=10
|
||||||
)
|
)
|
||||||
print(f"SSH connection test: returncode={result.returncode}, stdout='{result.stdout}', stderr='{result.stderr}'")
|
|
||||||
|
|
||||||
# SSH 成功或认证失败都说明 SSH 可用(returncode 0 或 1)
|
# SSH 成功或认证失败都说明 SSH 可用(returncode 0 或 1)
|
||||||
ssh_available = result.returncode in [0, 1]
|
ssh_available = result.returncode in [0, 1]
|
||||||
print(f"SSH availability: {ssh_available}")
|
|
||||||
return ssh_available
|
return ssh_available
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"SSH detection exception: {e}")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user