From a6e795684f9dfa03bcf68a0ef5672175984cb2b2 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sun, 11 Oct 2015 14:01:12 +0200 Subject: [PATCH] fix locale compilation, use variables for paths - install gettext - define and use variables checkout, home and appdir --- roots/gnuviechadmin/webinterface.sls | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/roots/gnuviechadmin/webinterface.sls b/roots/gnuviechadmin/webinterface.sls index 90bddd4..d18f88e 100644 --- a/roots/gnuviechadmin/webinterface.sls +++ b/roots/gnuviechadmin/webinterface.sls @@ -9,10 +9,14 @@ gnuviechadmin-packages: - python-virtualenv - python-dev - python-pip + - gettext {% import "webserver/sslcert.macros.sls" as sslcert %} {% 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') %} {{ sslcert.key_cert(domainname) }} @@ -23,7 +27,7 @@ gnuviechadmin-packages: - require: - cmd: gnuviechadmin-venv -/home/vagrant/gvasettings.sh: +{{ home }}/gvasettings.sh: file.managed: - user: vagrant - group: vagrant @@ -45,31 +49,32 @@ gnuviechadmin-requires: - name: {{ venv }}/bin/pip install -U -r requirements/local.txt && touch {{ venv }}/lastinstall - user: vagrant - group: vagrant - - cwd: /vagrant + - cwd: {{ checkout }} - require: - file: {{ venv }} - pkg: python-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: 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 - group: vagrant - - cwd: /vagrant/gnuviechadmin + - cwd: {{ appdir }} - watch: - cmd: gnuviechadmin-requires - - file: /home/vagrant/gvasettings.sh + - file: {{ home }}/gvasettings.sh gnuviechadmin-locale-data-compile: 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 - group: vagrant - - cwd: /vagrant/gnuviechadmin + - cwd: {{ appdir }} - require: - - file: /home/vagrant/gvasettings.sh + - pkg: gettext + - file: {{ home }}/gvasettings.sh - file: {{ venv }} /etc/nginx/sites-available/{{ domainname }}: @@ -85,8 +90,6 @@ gnuviechadmin-locale-data-compile: ssl_certdir: {{ salt['pillar.get']('nginx:sslcertdir', '/etc/nginx/ssl/certs') }} - require: - pkg: nginx - - watch_in: - - service: nginx /etc/nginx/sites-enabled/{{ domainname }}: file.symlink: