状态未形成为列表

State is not formed as a list

我有一个非常愚蠢的问题无法解决...:( 查看 Salt 文档应该可以,但不是...... - https://docs.saltproject.io/en/latest/topics/windows/windows-package-manager.html

chrome:
  latest:
    full_name: 'Google Chrome'
    installer: 'salt://software/GoogleChromeStandaloneEnterprise.msi'
    uninstaller: 'salt://software/GoogleChromeStandaloneEnterprise.msi'
    install_flags: '/qn /norestart'
    uninstall_flags: '/qn /norestart'
    msiexec: True
    locale: en_US
    reboot: False

putty:
  latest:
    installer: 'salt://software/putty-64bit-0.74-installer.msi'
    uninstaller: 'salt://software/putty-64bit-0.74-installer.msi'
    full_name:  'PuTTY'
    install_flags: '/qn'
    uninstall_flags: '/qn'
    msiexec: True
    locale: en_US
    reboot: False

winscp:
  latest:
    full_name: 'WinSCP'
    installer: 'salt://software/WinSCP-5.17.10-Setup.exe'
    uninstaller: 'salt://software/WinSCP-5.17.10-Setup.exe'
    install_flags: '/SP- /verysilent /norestart'
    uninstall_flags: '/verysilent'
    msiexec: False
    locale: en_US
    reboot: False

我得到:

    Data failed to compile:
----------
    State 'chrome' in SLS 'software/update-software' is not formed as a list
----------
    State 'putty' in SLS 'software/update-software' is not formed as a list
----------
    State 'winscp' in SLS 'software/update-software' is not formed as a list

知道问题出在哪里吗?

您似乎在同一个 SLS 文件中定义了多个软件产品?根据the page you cite:

There can be only one short name in the file

作为旁注,您是否考虑过仅使用 Chocolatey? It has packages for Chrome, Putty and WinSCP, and there is a state module 来使用它。

您显示的有问题的文件是 software definition file.

它不是一个你可以运行对抗小兵的state.sls文件。

此软件定义文件可以存储在主控器上的路径中,例如:win/repo-ng/custom_defs(默认位置)。它可以在主配置中使用 winrepo_dir_ng.

配置

示例win/repo-ng/custom_defs/putty.sls

putty:
  latest:
    installer: 'salt://software/putty-64bit-0.74-installer.msi'
    uninstaller: 'salt://software/putty-64bit-0.74-installer.msi'
    full_name:  'PuTTY'
    install_flags: '/qn'
    uninstall_flags: '/qn'
    msiexec: True
    locale: en_US
    reboot: False

然后在状态文件中 config_windows.sls:

install-putty:
  pkg.installed:
  - name: putty
  - version: latest

现在这个 pkg.installed 将引用我们的自定义定义文件 putty.sls 和 install/manage PuTTY。