fix(chv-muse-r11fix): authd 层 1 叶子树补 errors.py + stub __init__、层 2 seed 补三键

层 1:真实的 cloud/chv/__init__.py import executor/orphans,拷进
authd 最小叶子树(/usr/local/lib/chv-authd)会让 chv-authd 在
import 时 ModuleNotFoundError 而 crash loop——先是 errors.py
缺失,补上后又在 executor 上失败(探针 fixprobe3)。新增
chv-guest/authd_init_stub.py(仅导出 ChvFailure),build.sh 拷
errors.py + stub 作叶子树的 __init__.py,不再拷真实包 __init__;
P3_LIBS_PRESENT 条件加 errors.py;EXTRA_CONTENTS 加 errors.py 与
__init__.py;两 lockfile 脚本的 DECLARED_SOURCES 同款登记。
层 2:_seed_env_entries 把 guest-env 里的
GITEA_URL/GITEA_USER/SYNC_REPO 抄进 authd-seed(build_server
要求四键齐全,只 GITEA_TOKEN 即 ValueError);没有不补、不编
默认值。测试:seed 三键落盘/缺键不补、干跑夹具含新文件、lockfile
合成清单含新两项。
This commit is contained in:
host committed 2026-11-07 03:56:24 +00:00
1 parent b41fb67026
commit 2d12179b9a
8 files changed
+110 -13

No files matched your search

+43
View File
@@ -367,6 +367,49 @@ class SeedSplitTest(unittest.TestCase):
self.assertNotIn("GITEA_TOKEN",
entries["/etc/chv/guest-env"]["content"])
def test_write_seed_authd_entry_carries_sync_keys(self):
# round-11 真机修复(层 2):authd-seed 须同时有
# GITEA_URL/GITEA_USER/SYNC_REPO,build_server 才会放行
#(只 GITEA_TOKEN 时 ValueError,探针 fixprobe3 即从
# guest-env 补这三键);三键只在 guest-env 里有才抄。
import yaml
with tempfile.TemporaryDirectory() as tmp:
seed_dir = os.path.join(tmp, "seed")
write_seed(seed_dir, "vm1", "PRIV", "ssh-ed25519 AAAAx",
guest_env={
"GITEA_URL": "https://gitea.tose.top",
"GITEA_USER": "admin",
"SYNC_REPO": "admin/chv-sync-test",
"SYNC_BRANCH": "main"},
authd_env={"GITEA_TOKEN": TOKEN})
with open(os.path.join(seed_dir, "user-data")) as fh:
parsed = yaml.safe_load(fh.read())
entries = {e["path"]: e for e in parsed["write_files"]}
content = entries[AUTHD_SEED_PATH]["content"]
for key in ("GITEA_URL=https://gitea.tose.top",
"GITEA_USER=admin",
"SYNC_REPO=admin/chv-sync-test",
"GITEA_TOKEN="):
self.assertIn(key, content)
# 非同步键不进 authd-seed。
self.assertNotIn("SYNC_BRANCH", content)
def test_write_seed_authd_entry_without_sync_keys(self):
# guest-env 里没有三键时 authd-seed 只装密钥,不编默认值。
import yaml
with tempfile.TemporaryDirectory() as tmp:
seed_dir = os.path.join(tmp, "seed")
write_seed(seed_dir, "vm1", "PRIV", "ssh-ed25519 AAAAx",
authd_env={"GITEA_TOKEN": TOKEN})
with open(os.path.join(seed_dir, "user-data")) as fh:
parsed = yaml.safe_load(fh.read())
entries = {e["path"]: e for e in parsed["write_files"]}
content = entries[AUTHD_SEED_PATH]["content"]
self.assertIn("GITEA_TOKEN=", content)
self.assertNotIn("GITEA_URL", content)
self.assertNotIn("GITEA_USER", content)
self.assertNotIn("SYNC_REPO", content)
# -- (4) wake 预审 -----------------------------------------------------------
class _FakeResult: