Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pillar/kingfisher_main.sls
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ docker:
uid: 1005
syslog_logging: True

python:
version: '3.13'

kingfisher_collect:
user: collect
group: deployer
Expand Down
19 changes: 13 additions & 6 deletions salt/lib.sls
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,27 @@ unset {{ setting_name }} in {{ filename }}:
# Bug: The "user" parameter is ignored, unless the undocumented "runas" parameter is used.
# https://github.com/saltstack/salt/issues/59088#issuecomment-912148651
{% macro virtualenv(directory, user, parent_directory, requirements_file, watch_in=None) %}
{% if salt['pillar.get']('python:version') %}
# If the Python version changes, remove the virtual environment, so that it is recreated.
{{ directory }}-virtualenv-clear:
file.absent:
- name: {{ directory }}/.ve
- onchanges:
- pkg: python
- require_in:
- virtualenv: {{ directory }}-virtualenv
- virtualenv: {{ directory }}-uv
{% endif %}

{{ directory }}-virtualenv:
virtualenv.managed:
- name: {{ directory }}/.ve
- python: /usr/bin/python{{ salt['pillar.get']('python:version', 3) }}
- runas: {{ user }}
- user: {{ user }}
- require: {{ ([{'pkg': 'virtualenv'}] + [parent_directory])|yaml }}
{% if salt['pillar.get']('python:version') %}
# If the Python version changes, reinstall the virtual environment.
- watch:
- pkg: python
{% endif %}

# This state only differs from the *-virtualenv state by installing uv and not watching python.
# This state only differs from the *-virtualenv state by installing uv.
{{ directory }}-uv:
virtualenv.managed:
- name: {{ directory }}/.ve
Expand Down
2 changes: 0 additions & 2 deletions salt/python/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ python:
pkg.installed:
- pkgs:
- python{{ pillar.python.version }}
# Avoid "ModuleNotFoundError: No module named 'distutils.command'".
- python{{ pillar.python.version }}-distutils
- require:
- pkgrepo: python
{% endif %}
Loading