Home > front end >  How to define name of win package in salt state for python?
How to define name of win package in salt state for python?

Time:11-02

I'm tryint to create salt state for Windows, to install python3. Here is my sls file:

{% set version = "3.8.3150.0" %}
{% set SOURCE_PATH = 'http://local-nas/' %}

{% if grains['cpuarch'] == 'AMD64' %}
    {% set PROGRAM_FILES = "%ProgramFiles(x86)%" %}
{% else %}
    {% set PROGRAM_FILES = "%ProgramFiles%" %}
{% endif %}

python3:
  '{{ version }}':
    full_name: 'Python 3.8.3 (64-bit)'
    installer: '{{ SOURCE_PATH }}/python-3.8.3-amd64.exe'
    install_flags: '/quiet InstallAllUsers=1'
    uninstaller: '{{ PROGRAM_FILES }}\Python 3.8\uninstall.exe'
    uninstall_flags: '/quiet InstallAllUsers=1'
    msiexec: False

Problem is, when I run state.apply with salt, I get status failed, but python installs. I know, that version and full_name should exactly match as name and version in Add/Remove programs. And there is "Python 3.8.3 (64-bit)" and "Python Launcher". That's a little weird. But when I checked my node with pkg.list_pkgs, I found out there are several packager from Python and they all have different names:

    Python 3.8.3 Core Interpreter (64-bit):
        3.8.3150.0
    Python 3.8.3 Development Libraries (64-bit):
        3.8.3150.0
    Python 3.8.3 Documentation (64-bit):
        3.8.3150.0
    Python 3.8.3 Executables (64-bit):
        3.8.3150.0
    Python 3.8.3 Standard Library (64-bit):
        3.8.3150.0
    Python 3.8.3 Tcl/Tk Support (64-bit):
        3.8.3150.0
    Python 3.8.3 Test Suite (64-bit):
        3.8.3150.0
    Python 3.8.3 Utility Scripts (64-bit):
        3.8.3150.0
    Python 3.8.3 pip Bootstrap (64-bit):
        3.8.3150.0
    Python Launcher:
        3.8.7072.0

Question is - what name should I set in salt state "full_name" field to avoid failed status?

P.S. I tried to set "Python 3.8.3 Core Interpreter (64-bit)" - Didn't help.

CodePudding user response:

The fullname should be what shows up in pkg.list_pkgs which is the full name as displayed in add/remove packages. Also make sure you remember to sync the database after words, other wise the minion will not pick up the change. in this case the fullname it should be Python 3.8.3 Core Interpreter (64-bit)

  • Related