因此,我正在尝试使用蔚蓝CLI自动更新一个azure。为了做到这一点,我需要得到wiki etag:
az devops wiki page show\
--path 'my_project - Slab Quality Prediction/test' \
--wiki my_project.wiki \
--query 'eTag'输出:
"\"1156501f9cxxxxxbdca3456d6xxxxdd63\""如果我在命令中手动复制这个输出和过去
az devops wiki page update\
--path 'my_project - Slab Quality Prediction/test' \
--wiki my_project.wiki \
--version "\"1156501f9cxxxxxbdca3456d6xxxxdd63\"" \
--file-path test.md \
--encoding utf-8 它工作得很完美。
很好,现在只需要自动化,对吧?
etag=$(
az devops wiki page show\
--path 'my_project - Slab Quality Prediction/test' \
--wiki my_project.wiki \
--query 'eTag'
)
az devops wiki page update\
--path 'my_project - Slab Quality Prediction/test' \
--wiki my_project.wiki \
--version $etag \
--file-path test.md \
--encoding utf-8 \
--debug &> thebug错了,看错了。
错误消息:
Pre-condition `IfMatch` header provided in the request is an invalid page version. Please provide the version of the wiki page as the `IfMatch` header for the request.
Parameter name: IfMatch如果您查看一下debug选项,您会发现为什么会出现错误,这是因为etag没有正确设置:
version that show on debug: ... '--version', '"\\"1156501f9cxxxxxbdca3456d6xxxxdd63\\""', ...
what should be: "\"1156501f9cxxxxxbdca3456d6xxxxdd63\""我想不出有什么办法能让这个家伙明白。
发布于 2022-10-14 14:08:19
最后,它不需要(""),所以我只使用以下命令:
etag=$(
az devops wiki page show\
--path 'my_project - Slab Quality Prediction/test' \
--wiki my_project.wiki \
--query 'eTag'
)
az devops wiki page update\
--path 'my_project - Slab Quality Prediction/test' \
--wiki my_project.wiki \
--version ${etag:3:-3} \
--file-path test.md \
--encoding utf-8https://stackoverflow.com/questions/74069883
复制相似问题