From ede8718df9ea73d845d3cc40962997edbb99c170 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sun, 8 Jan 2012 23:03:24 +0000 Subject: refactor, clean and reindent transfiex module --- modules/transifex/manifests/init.pp | 176 ++++++++++++++---------------------- 1 file changed, 69 insertions(+), 107 deletions(-) (limited to 'modules') diff --git a/modules/transifex/manifests/init.pp b/modules/transifex/manifests/init.pp index 6407e1c8..d378e1b2 100644 --- a/modules/transifex/manifests/init.pp +++ b/modules/transifex/manifests/init.pp @@ -1,127 +1,89 @@ class transifex { - include django_application - package { 'transifex': - ensure => installed - } + include django_application + + package { 'transifex': } - $pgsql_password = extlookup("transifex_pgsql",'x') - $ldap_password = extlookup("transifex_ldap",'x') + $pgsql_password = extlookup("transifex_pgsql",'x') + $ldap_password = extlookup("transifex_ldap",'x') - $templates_dir = "/var/lib/transifex/templates" + $templates_dir = "/var/lib/transifex/templates" - postgresql::remote_db_and_user { 'transifex': + postgresql::remote_db_and_user { 'transifex': description => "Transifex database", password => $pgsql_password, - } - - file { "20-engines.conf": - path => "/etc/transifex/20-engines.conf", - ensure => present, - owner => root, - group => apache, - mode => 640, - content => template("transifex/20-engines.conf"), - require => Package['transifex'], - notify => Service['apache'] - } - - file { "30-site.conf": - path => "/etc/transifex/30-site.conf", - ensure => present, - owner => root, - group => root, - mode => 644, - content => template("transifex/30-site.conf"), - require => Package['transifex'], - notify => Service['apache'] - } + } - file { "40-apps.conf": - path => "/etc/transifex/40-apps.conf", - ensure => present, - owner => root, - group => root, - mode => 644, - content => template("transifex/40-apps.conf"), - require => Package['transifex'], - notify => Service['apache'] - } + define config() { + $filename = $name - file { "45-ldap.conf": - path => "/etc/transifex/45-ldap.conf", - ensure => present, - owner => root, - group => root, - mode => 644, - content => template("transifex/45-ldap.conf"), - require => Package['transifex'], - notify => Service['apache'] - } + file { "/etc/transifex/$filename": + group => apache, + mode => 640, + require => Package['transifex'], + notify => Service['apache'], + content => template("transifex/$filename"), + } + } - file { "50-project.conf": - path => "/etc/transifex/50-project.conf", - ensure => present, - owner => root, - group => root, - mode => 644, - content => template("transifex/50-project.conf"), - require => Package['transifex'], - notify => Service['apache'] - } + config { [ "20-engines.conf", + "30-site.conf", + "40-apps.conf", + "45-ldap.conf", + "50-project.conf"]: } - subversion::snapshot { $templates_dir: - source => "svn://svn.mageia.org/svn/web/templates/transifex/trunk" - } + subversion::snapshot { $templates_dir: + source => "svn://svn.mageia.org/svn/web/templates/transifex/trunk" + } - apache::vhost_django_app { "transifex.$domain": - module => "transifex", - use_ssl => true, - module_path => ["/usr/share/transifex","/usr/share","/usr/local/lib/"], - aliases => { "/site_media/static/admin/" => "/usr/lib/python2.6/site-packages/django/contrib/admin/media/", }, - } + apache::vhost_django_app { "transifex.$domain": + module => "transifex", + use_ssl => true, + module_path => ["/usr/share/transifex","/usr/share","/usr/local/lib/"], + aliases => { "/site_media/static/admin/" => "/usr/lib/python2.6/site-packages/django/contrib/admin/media/", }, + } - # tx need write access there when running in apache - file { "/var/lib/transifex/scratchdir/storage_files": - ensure => directory, - owner => apache, - group => apache, - require => Package['transifex'], - } + # tx need write access there when running in apache + file { "/var/lib/transifex/scratchdir/storage_files": + ensure => directory, + owner => apache, + group => apache, + require => Package['transifex'], + } - apache::vhost_redirect_ssl { "transifex.$domain": } + apache::vhost_redirect_ssl { "transifex.$domain": } - # the group are mapped from ldap, since AUTH_LDAP_FIND_GROUP_PERMS is set to yes - # but the group need to exist in django first - django_application::create_group { ["mga-i18n","mga-i18n-committers"]: - module => "transifex", - path => "/usr/share/transifex:/usr/share", - } + # the group are mapped from ldap, since AUTH_LDAP_FIND_GROUP_PERMS is set to yes + # but the group need to exist in django first + django_application::create_group { ["mga-i18n","mga-i18n-committers"]: + module => "transifex", + path => "/usr/share/transifex:/usr/share", + } - define committers_permission($app='') - { - # using django_application::add_permission_to_group may cause problem - # if we install a 2nd django application with the same permission name ( as it need - # to be unique ) - django_application::add_permission_to_group { $name: - app => $app, - group => 'mga-i18n-committers', - module => "transifex", - path => "/usr/share/transifex:/usr/share", - require => Django_application::Create_group['mga-i18n-committers'], + define committers_permission($app='') + { + # using django_application::add_permission_to_group may cause problem + # if we install a 2nd django application with the same permission name ( as it need + # to be unique ) + django_application::add_permission_to_group { $name: + app => $app, + group => 'mga-i18n-committers', + module => "transifex", + path => "/usr/share/transifex:/usr/share", + require => Django_application::Create_group['mga-i18n-committers'], + } } - } - committers_permission { ['add_project', - 'change_project', - 'delete_project']: } + committers_permission { ['add_project', + 'change_project', + 'delete_project']: } - committers_permission { ['add_release', - 'change_release', - 'delete_release']: } + committers_permission { ['add_release', + 'change_release', + 'delete_release']: } - committers_permission { [ 'add_resource', - 'change_resource', - 'delete_resource']: - app => "resources", - } + committers_permission { ['add_resource', + 'change_resource', + 'delete_resource']: + app => "resources", + } } -- cgit v1.2.1