Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/trac/manifests/init.pp

Issue 5735669590654976: #753 - set up an order system to let eyeo employees file order requests (Closed)
Patch Set: #753 - set up an order system to let eyeo employees file order requests Created July 22, 2014, 12:47 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/trac/manifests/init.pp
===================================================================
--- a/modules/trac/manifests/init.pp
+++ b/modules/trac/manifests/init.pp
@@ -2,7 +2,9 @@
$domain,
$certificate,
$private_key,
+ $permissions = "puppet:///modules/trac/permissions.csv",
Wladimir Palant 2014/07/22 13:52:24 Shouldn't this be an instance parameter? While thi
$is_default = false) inherits private::trac {
+
package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']:
ensure => present
}
@@ -25,17 +27,11 @@
}
class {'mysql::server':
- root_password => $database_root_password
- }
-
- mysql::db {'trac':
- user => 'trac',
- password => $database_password,
- host => 'localhost',
- grant => ['all'],
- charset => 'utf8',
- collate => 'utf8_bin',
- require => Class['mysql::server']
+ root_password => $database_root_password,
+ override_options => {
+ 'mysqld' => { 'federated' => true },
+ },
+ restart => true,
}
Exec {
@@ -48,16 +44,6 @@
unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1.0.1\" else 1)'",
}
- exec { 'trac_env':
- command => "trac-admin /home/trac/environment initenv \"Adblock Plus issue tracker\" mysql://trac:${database_password}@localhost:3306/trac",
- require => [
- Exec['install_trac'],
- Mysql_grant['trac@localhost/trac.*']
- ],
- user => trac,
- unless => "test -d /home/trac/environment"
- }
-
exec { 'install_BlackMagicTicketTweaks':
command => "pip install svn+http://trac-hacks.org/svn/blackmagictickettweaksplugin/0.12/",
require => Package['subversion', 'python-pip'],
@@ -118,72 +104,118 @@
unless => "python -c 'import tracspamfilter'",
}
- file {"/home/trac/environment/conf/trac.ini":
- ensure => present,
- content => template('trac/trac.ini.erb'),
- owner => trac,
- require => Exec['trac_env']
- }
-
exec { 'install_Tractags':
command => "pip install svn+http://trac-hacks.org/svn/tagsplugin/tags/0.7/",
require => Package['python-pip'],
unless => "python -c 'import tractags'",
}
- file {"/home/trac/htdocs/htdocs/common/adblockplus_logo.png":
- ensure => present,
- source => 'puppet:///modules/trac/adblockplus_logo.png',
- owner => trac,
- require => Exec['deploy']
- }
-
- file {"/home/trac/environment/htdocs/theme.css":
- ensure => present,
- source => 'puppet:///modules/trac/theme.css',
- owner => trac,
- require => Exec['trac_env']
- }
-
- exec {"update_env":
- command => "trac-admin /home/trac/environment upgrade",
- user => trac,
- require => [
- File['/home/trac/environment/conf/trac.ini'],
- Exec['install_SensitiveTickets'],
- Exec['install_BlackMagicTicketTweaks'],
- Exec['install_AccountManager'],
- Exec['install_AutocompleteUsers'],
- Exec['install_TicketTemplate'],
- Exec['install_NeverNotifyUpdater'],
- Exec['install_MasterTickets'],
- Exec['install_ThemeEngine'],
- Exec['install_Tractags'],
- Exec['install_TracSpamFilter']]
- }
-
- exec {"deploy":
- command => "trac-admin /home/trac/environment deploy /home/trac/htdocs && fromdos /home/trac/htdocs/cgi-bin/trac.fcgi && chmod 755 /home/trac/htdocs/cgi-bin/trac.fcgi",
- user => trac,
- require => [
- Exec["update_env"],
- Package["tofrodos"]]
- }
-
- spawn-fcgi::pool {"tracd":
- ensure => present,
- fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi",
- socket => "/tmp/trac-fastcgi.sock",
- mode => "0666",
- user => trac,
- children => 1,
- require => Exec['deploy'],
- }
-
file {"/home/trac/permissions.csv":
ensure => present,
owner => trac,
- source => 'puppet:///modules/trac/permissions.csv'
+ source => $permissions,
}
+ define instance (
+ $config = 'trac/trac.ini.erb',
+ $description = 'Issue Tracker',
+ $environment = 'environment',
+ $location = '/',
+ $logo = 'eyeo_logo.png',
+ $database = 'trac',
+ $database_password = $private::trac::database_password,
+ $theme = 'puppet:///modules/trac/theme.css') {
+
+ mysql::db {$database:
+ user => 'trac',
+ password => $database_password,
+ host => 'localhost',
+ grant => ['all'],
+ charset => 'utf8',
+ collate => 'utf8_bin',
+ require => Class['mysql::server'],
+ }
+
+ exec {"trac_env_$name":
+ command => "trac-admin /home/trac/$environment initenv \"$description\" mysql://trac:${database_password}@localhost:3306/$database",
Wladimir Palant 2014/07/31 09:46:53 Indeed, didn't know it existed. We should use that
+ path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
+ require => [
+ Exec['install_trac'],
+ Mysql_grant["trac@localhost/$database.*"]
+ ],
+ user => trac,
+ unless => "test -d /home/trac/$environment"
+ }
+
+ file {"/home/trac/$environment/conf/trac.ini":
+ ensure => present,
+ content => template($config),
+ owner => trac,
+ require => Exec["trac_env_$name"]
+ }
+
+ file {"/home/trac/$environment/htdocs/theme.css":
+ ensure => present,
+ source => $theme,
+ owner => trac,
+ require => Exec["trac_env_$name"],
+ }
+
+ exec {"update_env_$name":
+ command => "trac-admin /home/trac/$environment upgrade",
+ user => trac,
+ path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
+ require => [
+ File["/home/trac/$environment/conf/trac.ini"],
+ Exec['install_SensitiveTickets'],
+ Exec['install_BlackMagicTicketTweaks'],
+ Exec['install_AccountManager'],
+ Exec['install_AutocompleteUsers'],
+ Exec['install_TicketTemplate'],
+ Exec['install_NeverNotifyUpdater'],
+ Exec['install_MasterTickets'],
+ Exec['install_ThemeEngine'],
+ Exec['install_Tractags'],
+ Exec['install_TracSpamFilter']]
+ }
+
+ exec {"deploy_$name":
+ command => "trac-admin /home/trac/$environment deploy /home/trac/htdocs && fromdos /home/trac/htdocs/cgi-bin/trac.fcgi && chmod 755 /home/trac/htdocs/cgi-bin/trac.fcgi",
+ user => trac,
+ path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
+ require => [
+ Exec["update_env_$name"],
+ Package["tofrodos"]]
+ }
+
+ file {"/home/trac/htdocs/htdocs/common/$logo":
+ ensure => present,
+ source => "puppet:///modules/trac/$logo",
+ owner => trac,
+ require => Exec["deploy_$name"],
+ }
+
+ file {"/home/trac/htdocs/cgi-bin/trac.fcgi.$name":
+ ensure => present,
+ owner => trac,
+ mode => 774,
+ content => "#!/bin/sh
+ SCRIPT=`dirname \$0`/`basename \$0 .$name`
+ TRAC_ENV=/home/trac/$environment \$SCRIPT \"\$@\"
Wladimir Palant 2014/07/22 13:52:24 This hack is only necessary because of reusing the
+ ",
+ require => Exec["deploy_$name"],
+ }
+
+ spawn-fcgi::pool {"tracd_$name":
+ ensure => present,
+ fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi.$name",
+ socket => "/tmp/${name}-fastcgi.sock",
+ mode => "0666",
+ user => trac,
+ children => 1,
+ require => File["/home/trac/htdocs/cgi-bin/trac.fcgi.$name"],
+ }
+
+ }
}
+

Powered by Google App Engine
This is Rietveld