aboutsummaryrefslogtreecommitdiffstats
path: root/modules/django_application
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2012-03-24 15:27:19 +0000
committerMichael Scherer <misc@mageia.org>2012-03-24 15:27:19 +0000
commit1b9c7ba2b996a03d9addd83ffd96426fd25f7ecd (patch)
treecc1fdca186dc53e75f7a6ada579c70ba130d932f /modules/django_application
parent84dfd9dd945db45dacc186cf7517b8746d743c55 (diff)
downloadpuppet-1b9c7ba2b996a03d9addd83ffd96426fd25f7ecd.tar
puppet-1b9c7ba2b996a03d9addd83ffd96426fd25f7ecd.tar.gz
puppet-1b9c7ba2b996a03d9addd83ffd96426fd25f7ecd.tar.bz2
puppet-1b9c7ba2b996a03d9addd83ffd96426fd25f7ecd.tar.xz
puppet-1b9c7ba2b996a03d9addd83ffd96426fd25f7ecd.zip
split and clean the django_application module
Diffstat (limited to 'modules/django_application')
-rw-r--r--modules/django_application/manifests/add_permission_to_group.pp12
-rw-r--r--modules/django_application/manifests/create_group.pp10
-rw-r--r--modules/django_application/manifests/init.pp41
-rw-r--r--modules/django_application/manifests/script.pp9
4 files changed, 41 insertions, 31 deletions
diff --git a/modules/django_application/manifests/add_permission_to_group.pp b/modules/django_application/manifests/add_permission_to_group.pp
new file mode 100644
index 00000000..037ec882
--- /dev/null
+++ b/modules/django_application/manifests/add_permission_to_group.pp
@@ -0,0 +1,12 @@
+define django_application::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']
+ }
+}
+
diff --git a/modules/django_application/manifests/create_group.pp b/modules/django_application/manifests/create_group.pp
new file mode 100644
index 00000000..26a9a811
--- /dev/null
+++ b/modules/django_application/manifests/create_group.pp
@@ -0,0 +1,10 @@
+define django_application::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']
+ }
+}
+
+
diff --git a/modules/django_application/manifests/init.pp b/modules/django_application/manifests/init.pp
index 2fe9d2a2..2f209a54 100644
--- a/modules/django_application/manifests/init.pp
+++ b/modules/django_application/manifests/init.pp
@@ -1,39 +1,18 @@
# this class hold the common stuff for all django applications
-# as we cannot declare the same ressource twice ( ie, python-psycopg2 for example )
-# it is required to place this in a common class
+# as we cannot declare the same ressource twice ( ie,
+# python-psycopg2 for example )
+# it is required to place this in a common class
class django_application {
- package { ['python-django','python-psycopg2','python-django-auth-ldap']: }
+ package {['python-django',
+ 'python-psycopg2',
+ 'python-django-auth-ldap']: }
- file { "/usr/local/lib/custom_backend.py":
- source => "puppet:///modules/django_application/custom_backend.py",
+ file { '/usr/local/lib/custom_backend.py':
+ source => 'puppet:///modules/django_application/custom_backend.py',
notify => Service['apache']
}
- define script() {
- file { $name:
- path => "/usr/local/bin/$name",
- mode => 755,
- source => "puppet:///modules/django_application/$name",
- }
- }
-
- script { ['django_create_group.py','django_add_permission_to_group.py']: }
+ django_application::script { ['django_create_group.py',
+ 'django_add_permission_to_group.py']: }
- 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']
- }
- }
}
diff --git a/modules/django_application/manifests/script.pp b/modules/django_application/manifests/script.pp
new file mode 100644
index 00000000..96179c96
--- /dev/null
+++ b/modules/django_application/manifests/script.pp
@@ -0,0 +1,9 @@
+define django_application::script() {
+ file { $name:
+ path => "/usr/local/bin/$name",
+ mode => '0755',
+ source => "puppet:///modules/django_application/$name",
+ }
+}
+
+