Search code examples
salt-project

State is not formed as a list


I have a really stupid issue witch cannot resolve ... :( Looking at the Salt documentation should work but isn't ... - 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

I'm getting:

    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

Any idea where is the problem?


Solution

  • The file you have displayed in question is a software definition file.

    It is not a state.sls file that you can run against minions.

    This software definition file can be stored on the master at a path such as: win/repo-ng/custom_defs (default location). It is configurable in master config with winrepo_dir_ng.

    Example 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
    

    Then in a state file like config_windows.sls:

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

    Now this pkg.installed will refer to our custom definition file putty.sls and install/manage PuTTY.