fix locale compilation, use variables for paths

- install gettext
- define and use variables checkout, home and appdir
This commit is contained in:
Jan Dittberner 2015-10-11 14:01:12 +02:00
parent 6a0f88d7d4
commit 5578647f33

View file

@ -9,10 +9,14 @@ gnuviechadmin-packages:
- python-virtualenv - python-virtualenv
- python-dev - python-dev
- python-pip - python-pip
- gettext
{% import "webserver/sslcert.macros.sls" as sslcert %} {% import "webserver/sslcert.macros.sls" as sslcert %}
{% set venv = salt['pillar.get']('gnuviechadmin:virtualenv') %} {% set venv = salt['pillar.get']('gnuviechadmin:virtualenv') %}
{% set checkout = '/vagrant' %}
{% set home = '/home/vagrant' %}
{% set appdir = checkout + '/gnuviechadmin' %}
{% set domainname = salt['pillar.get']('gnuviechadmin:domainname') %} {% set domainname = salt['pillar.get']('gnuviechadmin:domainname') %}
{{ sslcert.key_cert(domainname) }} {{ sslcert.key_cert(domainname) }}
@ -23,7 +27,7 @@ gnuviechadmin-packages:
- require: - require:
- cmd: gnuviechadmin-venv - cmd: gnuviechadmin-venv
/home/vagrant/gvasettings.sh: {{ home }}/gvasettings.sh:
file.managed: file.managed:
- user: vagrant - user: vagrant
- group: vagrant - group: vagrant
@ -45,31 +49,32 @@ gnuviechadmin-requires:
- name: {{ venv }}/bin/pip install -U -r requirements/local.txt && touch {{ venv }}/lastinstall - name: {{ venv }}/bin/pip install -U -r requirements/local.txt && touch {{ venv }}/lastinstall
- user: vagrant - user: vagrant
- group: vagrant - group: vagrant
- cwd: /vagrant - cwd: {{ checkout }}
- require: - require:
- file: {{ venv }} - file: {{ venv }}
- pkg: python-dev - pkg: python-dev
- pkg: libpq-dev - pkg: libpq-dev
- unless: test -e {{ venv }}/lastinstall && test /vagrant/requirements/local.txt -ot {{ venv }}/lastinstall && test /vagrant/requirements/base.txt -ot {{ venv }}/lastinstall - unless: test -e {{ venv }}/lastinstall && test {{ checkout }}/requirements/local.txt -ot {{ venv }}/lastinstall && test {{ checkout }}/requirements/base.txt -ot {{ venv }}/lastinstall
gnuviechadmin-dbschema: gnuviechadmin-dbschema:
cmd.wait: cmd.wait:
- name: . /home/vagrant/gvasettings.sh ; {{ venv }}/bin/python manage.py migrate --noinput - name: . {{ home }}/gvasettings.sh ; unset LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME ; {{ venv }}/bin/python manage.py migrate --noinput
- user: vagrant - user: vagrant
- group: vagrant - group: vagrant
- cwd: /vagrant/gnuviechadmin - cwd: {{ appdir }}
- watch: - watch:
- cmd: gnuviechadmin-requires - cmd: gnuviechadmin-requires
- file: /home/vagrant/gvasettings.sh - file: {{ home }}/gvasettings.sh
gnuviechadmin-locale-data-compile: gnuviechadmin-locale-data-compile:
cmd.wait: cmd.wait:
- name: . /home/vagrant/gvasettings.sh ; find /vagrant/gnuviechadmin -type d -name 'locale' | while read dir; do cd $(dirname "$dir") ; {{ venv }}/bin/python /vagrant/gnuviechadmin/manage.py compilemessages ; done - name: . {{ home }}/gvasettings.sh ; find {{ appdir }} -type d -name 'locale' | while read dir; do cd $(dirname "$dir") ; {{ venv }}/bin/python {{ appdir }}/manage.py compilemessages ; done
- user: vagrant - user: vagrant
- group: vagrant - group: vagrant
- cwd: /vagrant/gnuviechadmin - cwd: {{ appdir }}
- require: - require:
- file: /home/vagrant/gvasettings.sh - pkg: gettext
- file: {{ home }}/gvasettings.sh
- file: {{ venv }} - file: {{ venv }}
/etc/nginx/sites-available/{{ domainname }}: /etc/nginx/sites-available/{{ domainname }}:
@ -85,8 +90,6 @@ gnuviechadmin-locale-data-compile:
ssl_certdir: {{ salt['pillar.get']('nginx:sslcertdir', '/etc/nginx/ssl/certs') }} ssl_certdir: {{ salt['pillar.get']('nginx:sslcertdir', '/etc/nginx/ssl/certs') }}
- require: - require:
- pkg: nginx - pkg: nginx
- watch_in:
- service: nginx
/etc/nginx/sites-enabled/{{ domainname }}: /etc/nginx/sites-enabled/{{ domainname }}:
file.symlink: file.symlink: