fix: custom setting of default failed caused by default.custom.yaml nonexistence#1126
fix: custom setting of default failed caused by default.custom.yaml nonexistence#1126lotem merged 2 commits intorime:masterfrom
Conversation
48d331f to
43947f1
Compare
43947f1 to
3eb7d2e
Compare
|
詳細講講…… 得弄懂小狼毫是怎麼用的 |
小狼毫之前是 自行保证用户目录一定有default.custom.yaml来避开这个坑 |
這代碼好爛!能不能給他改正。 |
好吧 |
|
我感到很矛盾。 CustomSettings::Load 返回值究竟應該是什麼含義? 首先他檢查 這個返回值,看起來作用就是返回有沒有加載到補丁文件,不然就一律返回 true 了。 到這一步,也就理解了,用戶應該處理 Load 返回 false 也就是不存在補丁文件的情況。小狼毫沒有認真做。 而 SwitcherSettings 呢,他既然是 CustomSettings 的子類,SwitcherSettings::Load 的語義也應該是打過補丁返回 true,沒打過補丁返回 false,才叫繼承了父的特徵,才是合法繼承人。你說是不是這個理? 分析到這裏我覺得用家,也就是 weasel/WeaselDeployer/Configurator.cpp:configure_switcher 很有問題。 |
这段我也不知道是谁写的 load_settings来判断一个custom.yaml是不是存在,因此前端应该检测不存在的时候创建一个? 但是换一个角度思考是,其他的CustomSettings是可以不依赖这个返回值依然正常工作可以继续定义内容,但是SwitcherSettings这个是返回false之后就后面有获取可用方案列表和已选方案列表的API跪了。要不然就是那两个API写得不行要修 |
|
那這個 SwitcherSettings::Load 邏輯也有問題,那些 上一條回覆我說錯了啊,不是加載原始文件而是編譯結果文件也就是已經生效的配置,(這裏的風險:如果此前部署失敗呢?staging 版本已過時?先忽略吧)
|
|
最好合成一个commit,最后那条随手写的msg |
Selected会受是不是过时的影响(但是这个也是合理的),可用的方案是遍历两个目录找.schema.yaml文件,这个应该问题不大 |
Pull request
Issue tracker
Fixes will automatically close the related issue
Fixes #
fix: custom setting of default failed caused by default.custom.yaml nonexistence
Feature
Describe feature of pull request
Unit test
Manual test
Code Review
Additional Info