[BUG] Commands triggered by virtualenv.managed might not respect the user param
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Commands triggered by virtualenv.managed might not respect the user parameter, which result in a pycache folder owned by root, triggering permission issues later on.
This bug is the same as #57550
Setup
Ubuntu 20.04, python 3.7, salt 3002.2
Example of state used:
virtualenv_init:
virtualenv.managed:
- venv_bin: virtualenv
- name: /opt/chimera/env/chimera
- python: /usr/bin/python3.8
- distribute: False
- user: chimera
- no_chown: True
virtualenv_setup_requirements/production.txt:
pip.installed:
- bin_env: /opt/chimera/env/chimera
- user: chimera
- no_chown: True
- requirements: /opt/chimera/chimera/requirements/production.txt
Expected behavior
Execution of the above state is partially executed as root and .pyc files are written as such.
[ERROR ] stderr: ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/penta/env/chimera/lib/python3.7/site-packages/__pycache__/zipp.cpython-37.pyc'
Consider using the --user option or check the permissions.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3002.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.5 (default, Jul 28 2020, 12:59:40)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-51-generic
system: Linux
version: Ubuntu 20.04 focal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the virtualenv.managed and pip.installed execution paths using the provided state on the listed Ubuntu and Salt versions. Trace how the user parameter is applied during virtual-environment setup and package installation; done means commands run for chimera and generated pycache files are not owned by root.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100