Skip to content

Commit 578b22e

Browse files
committed
Another stab to get multi-python support for virtualenv correctly
1 parent e5d7dc7 commit 578b22e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ sentry_https_url: no
1010
sentry_secret_key: 1LsmGR1DIyCJ5n2bRG5IVOFHdzEPkTKlW0RzxZVe9S0vc
1111
sentry_extensions: [] # List of sentry-extensions
1212

13-
sentry_virtualenv_command: virtualenv2.7 # In the case of multiple Python installations
13+
# Python configuration
14+
sentry_python: python2.7 # In the case of multiple Python installations
1415
# Pick one for Sentry using specific virtualenv command
1516

1617
sentry_ssl_certificate: # SSL certificate file - also turns on HTTPS on Nginx

tasks/sentry.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@
88

99
- name: Install Dependencies
1010
apt: name={{item}}
11-
with_items: [libxml2-dev, libxslt1-dev, zlib1g-dev,libffi-dev, python-virtualenv, python-dev]
11+
with_items: [libxml2-dev, libxslt1-dev, zlib1g-dev, libffi-dev]
12+
13+
# Try to create virtualenv only if it doesn't exist.
14+
# This way we can rerun the playbook without errors.
15+
# true && hack at the start of the line, otherwise one gets YAML syntax errors
16+
- name: Create virtualenv for Sentry using chosen Python
17+
shell: true && [[ ! -d {{sentry_home}}/env ]] || virtualenv --python={{sentry_python}} {{sentry_home}}/env
18+
sudo: yes
19+
sudo_user: "{{sentry_user}}"
1220

1321
- name: Install Sentry
14-
pip: name=sentry executable={{sentry_home}}/env/bin/pip version={{sentry_version}} virtualenv_command="{{sentry_virtualenv_command}}" virtualenv="{{sentry_home}}"/env
22+
pip: name=sentry executable={{sentry_home}}/env/bin/pip version={{sentry_version}} virtualenv="{{sentry_home}}"/env
1523
sudo: yes
1624
sudo_user: "{{sentry_user}}"
1725

0 commit comments

Comments
 (0)