Skip to content

[BUG] "salt" python module is not installed with onedir package #63441

@hadouvex

Description

@hadouvex

Description
"salt" python module is not installed with onedir package as it was with classic one. In that case some modules or states don't work, e.g. "file.serialize". Installing salt from classic packages repo or via pip fixes the problem, but we'd prefer to follow official recommendations and use onedir packages

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Ubuntu 22.04 Jammy

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior

   apt update
   apt install salt-common
   apt install salt-minion
  • check if python module "salt" is available; run:
    python3 -c "import pkg_resources; installed_packages = [(d.project_name, d.version) for d in pkg_resources.working_set]; print(installed_packages)"
  • see no mention of "salt" module

Expected behavior
run:
python3 -c "import pkg_resources; installed_packages = [(d.project_name, d.version) for d in pkg_resources.working_set]; print(installed_packages)"
see the following in printed out list:
('salt', '3005.1')

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

salt-master version is 3004.2, but it is not the case. It still works with 3005.1 version shipped via classic package repo

Salt Version:
          Salt: 3005.1
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.0
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.9.16 (main, Dec 14 2022, 15:47:32)
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: ubuntu 22.04 jammy
        locale: utf-8
       machine: x86_64
       release: 5.15.0-56-generic
        system: Linux
       version: Ubuntu 22.04 jammy

Additional context
Example of incorrect behavior of "file.serialize" state:
running on minion:
sudo salt-call state.apply kubernetes.k8s.containerd_config test=0
produces following:

local:
The State execution failed to record the order in which all states were executed. The state return missing data is:
{'changes': {},
 'comment': 'An exception occurred in this state: Malformed state return. Data '
            'must be a dictionary type.',
 'name': 'later',
 'result': False}
----------
          ID: install_python_toml_module
    Function: pkg.installed
        Name: python3-toml
      Result: True
     Comment: All specified packages are already installed
     Started: 17:32:52.812550
    Duration: 42.545 ms
     Changes:   
----------
          ID: manage_containerd_config
    Function: file.serialize
        Name: /etc/containerd/config.toml
      Result: False
     Comment: An exception occurred in this state: Malformed state return. Data must be a dictionary type.
     Changes:   

Summary for local
------------
Succeeded: 1
Failed:    1

kubernetes.k8s.containerd_config content:

install_python_toml_module:
  pkg.installed:
    - name: python3-toml

manage_containerd_config:
  file.serialize:
    - name: /etc/containerd/config.toml
    - formatter: toml
    - merge_if_exists: True
    - user: root
    - group: root
    - mode: 644
    - require:
        - pkg: install_python_toml_module
    - dataset:
        metrics:
          address: "0.0.0.0:1338"

when switching to classic repo and reinstalling salt-common, salt-minion the state works perfectly:

sudo apt remove salt-minion
sudo apt remove salt-common

replace repo
deb https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest/ jammy main
to
deb https://repo.saltproject.io/py3/ubuntu/20.04/amd64/3005/ focal main (since there's no classic package for 22.04)

install packages again:

apt update
apt install salt-common
apt install salt-minion

run state:
sudo salt-call state.apply kubernetes.k8s.containerd_config test=0
which produces:

local:
----------
          ID: install_python_toml_module
    Function: pkg.installed
        Name: python3-toml
      Result: True
     Comment: All specified packages are already installed
     Started: 17:43:01.855975
    Duration: 42.679 ms
     Changes:   
----------
          ID: manage_containerd_config
    Function: file.serialize
        Name: /etc/containerd/config.toml
      Result: True
     Comment: The file /etc/containerd/config.toml is in the correct state
     Started: 17:43:01.901573
    Duration: 14.839 ms
     Changes:   

Summary for local
------------
Succeeded: 2
Failed:    0

So with the classic package installation it works unlike with onedir

Metadata

Metadata

Assignees

No one assigned

    Labels

    PackagingRelated to packaging of Salt, not Salt's support for package management.bugbroken, incorrect, or confusing behaviorexpected-behaviorintended functionalityneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions