Resource
Resource在Pull Server上的格式是这样的:
{ModuleName}_{Version}.zip
比如
Blog_1.0.0.0.zip
如果你修改了Resource中的代码,理论上,只要更新,就得发新版本,哪怕是个小版本的变更。
Blog_1.0.0.1.zip
这很合理。
问题
但是,官方的文档是这么描述的
You can force a Node to update its resources by changing the version number in the archive's name, or by creating a new checksum. The Pull Client will check for newer versions of required resources, as well as updated checksums, when its LCM refreshes.
我来翻译一下啊
You can force a Node to update its resources by changing the version number in the archive's name, or by creating a new checksum.
你可以强制Node更新resources, 通过修改压缩包的版本号码,【或者】创建一个新的checksum
The Pull Client will check for newer versions of required resources, as well as updated checksums, when its LCM refreshes.
当LCM刷新的时候,Cient将会检查所需资源的新版本 和 更新后的checksum.
重点注意上面翻译中的关键词:或者。
我是个认真读文档的人,那么我就想了:
按照这意思,我如果对resource做了修改,我可以不修改版本号,直接生成一个新的checksum, Node也会强制拉取(因为做了修改,所以checksum一定会改变的)
但是,我跑了N多test后发现
只要我们configuration中指定的resource资源的版本在Node服务器上存在,当pull configuration的时候,压根就不会理会Pull Server上的Resource。
别说checksum改变成一个新的值(合法的,或者不合法的),即使把Resource删除了都没任何影响。
我想会不会是因为我使用低版本的xPSDesiredStateConfiguration 安装DSC pull web service有问题,于是尝试更新到新版本,重新部署DSC pull web service
Install-Module -Name xPSDesiredStateConfiguration -RequiredVersion 9.1.0
结果是一样的。
反馈
我给文档提了Issue:https://github.com/MicrosoftDocs/PowerShell-Docs-DSC/issues/83
回复是:
Hi, Thanks for taking the time to file this issue. The feature is documented to match the implementation.
It seems like you may have encountered a bug or other problem. Unfortunately, we're not able to provide support in this repository.
I would suggest that you try posting your problem in a community support forum with a detailed minimal repro that shows the behavior you're seeing in a lab environment, if possible. That helps folks see what might be wrong more easily.
大概意思是文档写的好着呢,你可能遇到bug了,你可以和社区小伙伴讨论。
等我有时间到 https://github.com/dsccommunity/xPSDesiredStateConfiguration/issues/new?assignees=&labels=&template=Problem_with_resource.yml 这里提issue问问。
结论
第一部分也说了,一般有修改就会更新版本,这是合理的。
但是官方文档的描述有误导嫌疑
把
You can force a Node to update its resources by changing the version number in the archive's name, or by creating a new checksum
改成
You can force a Node to update its resources by changing the version number in the archive's name and creating a new checksum
就好。