1 |
# this class hold the common stuff for all django applications |
# this class hold the common stuff for all django applications |
2 |
# as we cannot declare the same ressource twice ( ie, python-psycopg2 for example ) |
# as we cannot declare the same ressource twice ( ie, |
3 |
# it is required to place this in a common class |
# python-psycopg2 for example ) |
4 |
|
# it is required to place this in a common class |
5 |
class django_application { |
class django_application { |
6 |
package { ['python-django','python-psycopg2','python-django-auth-ldap']: } |
package {['python-django', |
7 |
|
'python-psycopg2', |
8 |
|
'python-django-auth-ldap']: } |
9 |
|
|
10 |
file { "/usr/local/lib/custom_backend.py": |
file { '/usr/local/lib/custom_backend.py': |
11 |
source => "puppet:///modules/django_application/custom_backend.py", |
source => 'puppet:///modules/django_application/custom_backend.py', |
12 |
notify => Service['apache'] |
notify => Service['apache'] |
13 |
} |
} |
14 |
|
|
15 |
define script() { |
django_application::script { ['django_create_group.py', |
16 |
file { $name: |
'django_add_permission_to_group.py']: } |
|
path => "/usr/local/bin/$name", |
|
|
mode => 755, |
|
|
source => "puppet:///modules/django_application/$name", |
|
|
} |
|
|
} |
|
|
|
|
|
script { ['django_create_group.py','django_add_permission_to_group.py']: } |
|
17 |
|
|
|
define create_group($path,$module) { |
|
|
exec { "/usr/local/bin/django_create_group.py $name": |
|
|
user => root, |
|
|
environment => ["DJANGO_SETTINGS_MODULE=$module.settings", |
|
|
"PYTHONPATH=$path" ], |
|
|
require => Django_application::Script['django_create_group.py'] |
|
|
} |
|
|
} |
|
|
|
|
|
define add_permission_to_group($path,$module,$group, $app='') { |
|
|
exec { "/usr/local/bin/django_add_permission_to_group.py $group $name $app": |
|
|
user => root, |
|
|
environment => ["DJANGO_SETTINGS_MODULE=$module.settings", |
|
|
"PYTHONPATH=$path" ], |
|
|
require => Django_application::Script['django_add_permission_to_group.py'] |
|
|
} |
|
|
} |
|
18 |
} |
} |