Pull Request已成功合入, 合并人@openeuler-ci-bot
(感谢 xianxian-sauce 的贡献)变更摘要
该 PR 针对 issues #192、#193、#194 进行修复。核心改动包括:conchd 启动时通过新增的 ensureProcessTempDir 自动创建 TMPDIR 目录,避免自定义临时目录不存在导致 Template 创建失败;config.LoadConfig 在显式指定的配置文件不存在时直接返回错误,不再静默回退到默认配置;internal/image/errors.go 将 containerd registry reference 校验错误(ErrInvalid、ErrObjectRequired、ErrHostnameRequired)映射为 HTTP 400(ErrInvalidArgument);containerd/template 的 Store.Delete 不再对不存在的记录静默返回成功,而是返回 conchtemplate.ErrNotFound(HTTP 404),同时移除 Delete 中 errdefs.IsNotFound 的吞错分支,使 template rm 对不存在或已并发变化的 Template 如实报错。
主要改动
- daemon 启动时自动创建临时目录:在
internal/daemon/daemon.go的New中新增ensureProcessTempDir调用,通过os.MkdirAll(os.TempDir(), 0o700)确保TMPDIR存在,修复 #192;新增internal/daemon/temp_test.go覆盖该行为。 - 显式配置文件缺失时直接报错:
internal/config/config.go的LoadConfig删除os.IsNotExist时返回DefaultConfig()的分支,改为返回 "failed to read config file" 错误;internal/cli/client/client_test.go相应改为验证New返回os.ErrNotExist。 - registry reference 校验错误映射为 HTTP 400:
internal/image/errors.go的translateRegistryError将containerdreference.ErrInvalid、ErrObjectRequired、ErrHostnameRequired包装为ErrInvalidArgument,并以internal/image/errors_test.go新增用例验证分类结果。 template rm对不存在模板返回 404:internal/adapters/containerd/template/store.go的Delete移除记录不存在时返回nil的短路逻辑及errdefs.IsNotFound吞错判断,改为统一经translateError返回conchtemplate.ErrNotFound;同步更新store_test.go与internal/conchruntime/service_test.go,将第二次删除的幂等断言改为期望ErrNotFound。


Welcome To openEuler Community
Hey @lsxlee99 , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
Contact Guide
If you have any questions, please contact the SIG: sig-CloudNative ,
and any of the maintainers: @duguhaotian, @gaodaweiky, @jimmieme, @lu-wei-army, @weibaohui, @wonleing, @yangzhao_kl, @zhaoyifan28, @zmr_2020 ,
and any of the committers: @Yekelu .


/lgtm
/approve


改动内容
TMPDIR,避免自定义临时目录不存在导致 Template 创建失败。template rm删除不存在或已并发变化的 Template 时返回 HTTP 404,不再错误提示删除成功。验证
go vet ./...通过。conch、conchd构建通过。