1 |
class transifex { |
2 |
include django_application |
3 |
|
4 |
package { 'transifex': } |
5 |
|
6 |
$pgsql_password = extlookup('transifex_pgsql','x') |
7 |
$ldap_password = extlookup('transifex_ldap','x') |
8 |
|
9 |
$templates_dir = "/var/lib/transifex/templates" |
10 |
|
11 |
postgresql::remote_db_and_user { 'transifex': |
12 |
description => 'Transifex database', |
13 |
password => $pgsql_password, |
14 |
} |
15 |
|
16 |
define config() { |
17 |
$filename = $name |
18 |
|
19 |
file { "/etc/transifex/$filename": |
20 |
group => 'apache', |
21 |
mode => '0640', |
22 |
require => Package['transifex'], |
23 |
notify => Service['apache'], |
24 |
content => template("transifex/$filename"), |
25 |
} |
26 |
} |
27 |
|
28 |
config { ['20-engines.conf', |
29 |
'30-site.conf', |
30 |
'40-apps.conf', |
31 |
'45-ldap.conf', |
32 |
'50-project.conf']: } |
33 |
|
34 |
subversion::snapshot { $templates_dir: |
35 |
source => 'svn://svn.mageia.org/svn/web/templates/transifex/trunk' |
36 |
} |
37 |
|
38 |
apache::vhost::django_app { "transifex.$::domain": |
39 |
module => 'transifex', |
40 |
use_ssl => true, |
41 |
module_path => ['/usr/share/transifex','/usr/share','/usr/local/lib/'], |
42 |
aliases => { '/site_media/static/admin/' => '/usr/lib/python2.6/site-packages/django/contrib/admin/media/', }, |
43 |
} |
44 |
|
45 |
# tx need write access there when running in apache |
46 |
file { '/var/lib/transifex/scratchdir/storage_files': |
47 |
ensure => directory, |
48 |
owner => 'apache', |
49 |
group => 'apache', |
50 |
require => Package['transifex'], |
51 |
} |
52 |
|
53 |
apache::vhost::redirect_ssl { "transifex.$::domain": } |
54 |
|
55 |
# the group are mapped from ldap, since AUTH_LDAP_FIND_GROUP_PERMS is set to yes |
56 |
# but the group need to exist in django first |
57 |
django_application::create_group { ['mga-i18n','mga-i18n-committers']: |
58 |
module => 'transifex', |
59 |
path => '/usr/share/transifex:/usr/share', |
60 |
} |
61 |
|
62 |
define committers_permission($app='') |
63 |
{ |
64 |
# using django_application::add_permission_to_group may cause problem |
65 |
# if we install a 2nd django application with the same permission name ( as it need |
66 |
# to be unique ) |
67 |
django_application::add_permission_to_group { $name: |
68 |
app => $app, |
69 |
group => 'mga-i18n-committers', |
70 |
module => 'transifex', |
71 |
path => '/usr/share/transifex:/usr/share', |
72 |
require => Django_application::Create_group['mga-i18n-committers'], |
73 |
} |
74 |
} |
75 |
|
76 |
committers_permission {['add_project', |
77 |
'change_project', |
78 |
'delete_project']: } |
79 |
|
80 |
committers_permission {['add_release', |
81 |
'change_release', |
82 |
'delete_release']: } |
83 |
|
84 |
committers_permission {['add_resource', |
85 |
'change_resource', |
86 |
'delete_resource']: |
87 |
app => 'resources', |
88 |
} |
89 |
} |