fix(tools-pve/asr-pipeline): support /state/vault and /state/ssh inside container
This commit is contained in:
@@ -10,6 +10,7 @@ Ported from the legacy shell implementation with its hard-won details preserved:
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
@@ -90,10 +91,23 @@ def update_pending(date: str, title: str, path: Path) -> None:
|
||||
|
||||
|
||||
def _git(*args, check=False) -> subprocess.CompletedProcess:
|
||||
env = dict(os.environ)
|
||||
for key_candidate in (
|
||||
CFG.state_dir / "ssh" / "id_ed25519_gitea",
|
||||
Path("/state/ssh/id_ed25519_gitea"),
|
||||
Path("/root/.ssh/id_ed25519_gitea"),
|
||||
Path.home() / ".ssh" / "id_ed25519_gitea",
|
||||
):
|
||||
if key_candidate.exists():
|
||||
env.setdefault(
|
||||
"GIT_SSH_COMMAND",
|
||||
f"ssh -i {key_candidate} -o StrictHostKeyChecking=accept-new -o IdentitiesOnly=yes",
|
||||
)
|
||||
break
|
||||
return subprocess.run(
|
||||
["git", "-c", f"safe.directory={CFG.vault}", *args],
|
||||
cwd=CFG.vault, capture_output=True,
|
||||
text=True, timeout=180, check=check,
|
||||
text=True, timeout=180, check=check, env=env,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user