saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.11k stars 5.47k forks source link

[BUG] Environment could not be retrieved if there is an incorrect PYTHONHOME env #65537

Open fanaticize opened 10 months ago

fanaticize commented 10 months ago

Description Environment could not be retrieved if there is an incorrect PYTHONHOME env

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

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

Steps to Reproduce the behavior (Include debug logs if possible and relevant)

Expected behavior The error "Environment could not have been saved for user" should not occur and should operate normally.

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.) ```yaml Salt Version: Salt: 3006.2 Python Version: Python: 3.10.12 (main, Aug 3 2023, 21:47:10) [GCC 11.2.0] 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.2 libgit2: Not Installed looseversion: 1.0.2 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 22.0 pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: Not Installed python-gnupg: 0.4.8 PyYAML: 6.0.1 PyZMQ: 23.2.0 relenv: 0.13.3 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: rhel 8.8 Ootpa locale: utf-8 machine: x86_64 release: 4.18.0-477.15.1.el8_8.x86_64 system: Linux version: Red Hat Enterprise Linux 8.8 Ootpa ```

Additional context PYTHONHOME seems to need an unset when running env_cmd.

OrangeDog commented 10 months ago

The command runs Python code as that user, so you would expect it to fail if that user's Python environment were deliberately broken.

fanaticize commented 10 months ago
... program name = '/opt/saltstack/salt/bin/python3.10'\n  ...

Salt is using /opt/saltstack/salt/bin/python3.10 rather than the user's installed python. This doesn't seem to be the intended result, so I reported it.