• PowerShell DSC Resource更新问题


    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.

    ref:https://docs.microsoft.com/en-us/powershell/dsc/pull-server/package-upload-resources?view=dsc-1.1#updating-resources

    我来翻译一下啊

    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
    

    就好。

  • 相关阅读:
    js日期加减得到新的日期的自定义函数
    c# winform 一个可以用鼠标改变控件位置和大小的类,调用即可
    颜色英文代码全集
    你的Web系统有多少安全漏洞
    robots协议和禁止搜索引擎收录
    Linux下./configure错误详解
    c# winform 关于DataGridView的一些操作
    通过JSONP实现完美跨域
    tabs选项卡
    jQuery 1.4的十五大新功能实例精讲
  • 原文地址:https://www.cnblogs.com/talentzemin/p/16526991.html
Copyright © 2020-2023  润新知