summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-11-08 13:34:58 (EST)
committer Steffen Pingel2012-11-08 13:34:58 (EST)
commit69ad377197e2f5685f28a2554758e1efe38c8d01 (patch)
tree37e6a54060fb7b17e8206414a018668ac90e5d00
parent9b5c8275bffdb21b22e8929251f5d9d39989688d (diff)
downloadorg.eclipse.mylyn.tasks-69ad377197e2f5685f28a2554758e1efe38c8d01.zip
org.eclipse.mylyn.tasks-69ad377197e2f5685f28a2554758e1efe38c8d01.tar.gz
org.eclipse.mylyn.tasks-69ad377197e2f5685f28a2554758e1efe38c8d01.tar.bz2
386344: improve reuse of puppet Trac configurationrefs/changes/08/8608/1
Change-Id: Ie662234a9340960786349106b076cf0275abd8d9 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386344
-rw-r--r--org.eclipse.mylyn.trac.releng/manifests/default.pp83
-rw-r--r--org.eclipse.mylyn.trac.releng/modules/trac/manifests/defaultsites.pp35
-rw-r--r--org.eclipse.mylyn.trac.releng/modules/trac/manifests/init.pp115
-rw-r--r--org.eclipse.mylyn.trac.releng/modules/trac/manifests/plugin.pp14
-rw-r--r--org.eclipse.mylyn.trac.releng/modules/trac/manifests/site.pp246
-rw-r--r--org.eclipse.mylyn.trac.releng/modules/trac/manifests/trac.pp67
6 files changed, 288 insertions, 272 deletions
diff --git a/org.eclipse.mylyn.trac.releng/manifests/default.pp b/org.eclipse.mylyn.trac.releng/manifests/default.pp
index 61a203a..a7a45b9 100644
--- a/org.eclipse.mylyn.trac.releng/manifests/default.pp
+++ b/org.eclipse.mylyn.trac.releng/manifests/default.pp
@@ -1,85 +1,6 @@
-Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
+Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
-$tools = "/tmp/tools"
-
-include apache
-
-class apache {
- package { "apache2":
- ensure => present,
- }
-
- package { "libapache2-mod-fcgid" :
- ensure => "installed",
- }
-
- service { "apache2":
- ensure => running,
- require => Package["apache2"],
- }
-
- exec { "Enable auth_digest module":
- command => "a2enmod auth_digest",
- require => Package["apache2"],
- creates => "/etc/apache2/mods-enabled/auth_digest.load",
- }
-
- exec { "Enable fcgid module":
- command => "a2enmod fcgid",
- require => Package["libapache2-mod-fcgid"],
- creates => "/etc/apache2/mods-enabled/fcgid.load",
- }
-
- exec { "Enable proxy mod":
- command => "a2enmod proxy",
- require => Package["apache2"],
- creates => "/etc/apache2/mods-enabled/proxy.load",
- }
-
- exec { "Enable proxy_http mod":
- command => "a2enmod proxy_http",
- require => Package["apache2"],
- creates => "/etc/apache2/mods-enabled/proxy_http.load",
- }
-
- exec { "Enable ssl module":
- command => "a2enmod ssl",
- require => Package["apache2"],
- creates => "/etc/apache2/mods-enabled/ssl.load",
- }
-
- file { "/etc/apache2/sites-enabled/001-default-ssl":
- ensure => link,
- target => "/etc/apache2/sites-available/default-ssl",
- }
-
-}
-
-exec { "apt-get update":
- command => "apt-get update",
- onlyif => "find /var/lib/apt/lists/ -mtime -7 | (grep -q Package; [ $? != 0 ])",
-}
-
-package { "openjdk-6-jre" :
- ensure => "installed",
- require => Exec["apt-get update"],
-}
-
-Trac {
- base => "$tools/trac",
-}
-Trac::Plugin {
- base => "$tools/trac",
-}
-Trac::Site {
- base => "$tools/trac",
-}
+include "trac"
trac::defaultsites { "trac":
}
-
-file { "/etc/apache2/conf.d/trac.conf":
- content => "DefaultInitEnv PYTHON_EGG_CACHE /tmp/eggs\nInclude $tools/trac/conf.d/[^.#]*\n",
- require => Package["apache2"],
- notify => Service["apache2"],
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/defaultsites.pp b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/defaultsites.pp
index 1f9be05..e63b523 100644
--- a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/defaultsites.pp
+++ b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/defaultsites.pp
@@ -1,34 +1,39 @@
-define trac::defaultsites {
+define trac::defaultsites (
+ $base = $trac::base,
+) {
-/* Trac automatically provisions during install "python-genshi" */
+include "trac"
-$requirements = [ "python-pysqlite2", "python-setuptools", "python-subversion", "subversion", ]
-package { $requirements:
- ensure => "installed"
-}
+/* Defaults */
-/* Defaults. */
-Trac {
- require => Package[$requirements],
+Trac::Trac {
+ base => $base,
+}
+Trac::Plugin {
+ base => $base,
}
-
Trac::Site {
+ base => $base,
version => "1.0",
require => Trac["1.0"],
}
-trac { "0.11.7":
+/* Instances */
+
+trac::trac { "0.11.7":
}
-trac { "0.12.4":
+trac::trac { "0.12.4":
}
-trac { "1.0":
+trac::trac { "1.0":
}
-trac { "trunk":
+trac::trac { "trunk":
}
+/* Plugins */
+
trac::plugin { "accountmanagerplugin-0.11":
url => "http://trac-hacks.org/svn/accountmanagerplugin/0.11",
egg => "TracAccountManager",
@@ -44,6 +49,8 @@ trac::plugin { "xmlrpcplugin-trunk":
egg => "TracXMLRPC",
}
+/* Sites */
+
trac::site { "trac-0.11":
version => "0.11.7",
require => Trac["0.11.7"],
diff --git a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/init.pp b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/init.pp
index 93b9fa9..eb386de 100644
--- a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/init.pp
+++ b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/init.pp
@@ -1,66 +1,61 @@
-define trac(
- $version = "$title",
- $base = "/home/tools/trac"
-) {
- $srcbase = "$base/src/trac-$version"
- $prefix = "$base/share/trac-$version"
+class trac {
+ $base = "/home/tools/trac"
- Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
-
- exec { "prepare $version":
- command => "mkdir -p $base/bin $base/conf.d $base/src $base/var $prefix",
- creates => "$prefix",
- }
-
- file { "$srcbase":
- ensure => "directory",
- require => Exec["prepare $version"]
- }
- if $version == "trunk" {
- exec { "extract trac $version":
- command => "svn checkout http://svn.edgewall.org/repos/trac/trunk Trac-trunk",
- cwd => "$srcbase",
- creates => "$srcbase/Trac-$version",
- require => File["$srcbase"],
- }
- } else {
- exec { "download trac $version":
- command => "wget -O $srcbase/Trac-$version.tar.gz http://download.edgewall.org/trac/Trac-$version.tar.gz",
- creates => "$srcbase/Trac-$version.tar.gz",
- require => File["$srcbase"],
- }
-
- exec { "extract trac $version":
- command => "tar -C $srcbase -xzvf $srcbase/Trac-$version.tar.gz",
- require => Exec["download trac $version"],
- creates => "$srcbase/Trac-$version",
- }
- }
+ /* Common requirements for all Trac instances */
+ exec { "apt-get update":
+ command => "apt-get update",
+ onlyif => "find /var/lib/apt/lists/ -mtime -7 | (grep -q Package; [ $? != 0 ])",
+ }
- file { "$srcbase/install.sh":
- source => "puppet:///modules/trac/install.sh",
- mode => '755',
- }
-
- exec { "install $version":
- command => "$srcbase/install.sh $srcbase/Trac-$version $prefix $version",
- path => ".",
- logoutput => false,
- require => Exec["extract trac $version"],
- creates => "$prefix/lib/.provisioned",
- }
+ /* Trac automatically provisions during install "python-genshi" */
- file { "$base/bin/trac-$version.cgi":
- content => template('trac/trac.cgi.erb'),
- require => Exec["prepare $version"],
- mode => 755,
- }
+ $requirements = ["apache2", "libapache2-mod-fcgid", "python-pysqlite2", "python-setuptools", "python-subversion", "subversion",]
- file { "$base/bin/tracadmin-$version":
- content => template('trac/tracadmin.erb'),
- mode => 755,
- require => Exec["prepare $version"]
- }
+ package { $requirements:
+ ensure => "installed",
+ require => Exec["apt-get update"],
+ }
-} \ No newline at end of file
+ service { "apache2":
+ ensure => running,
+ require => Package["apache2"],
+ }
+
+ exec { "Enable auth_digest module":
+ command => "a2enmod auth_digest",
+ require => Package["apache2"],
+ creates => "/etc/apache2/mods-enabled/auth_digest.load",
+ }
+
+ exec { "Enable fcgid module":
+ command => "a2enmod fcgid",
+ require => Package["libapache2-mod-fcgid"],
+ creates => "/etc/apache2/mods-enabled/fcgid.load",
+ }
+
+ exec { "Enable ssl module":
+ command => "a2enmod ssl",
+ require => Package["apache2"],
+ creates => "/etc/apache2/mods-enabled/ssl.load",
+ }
+
+ file { "/etc/apache2/sites-enabled/001-default-ssl":
+ ensure => link,
+ target => "/etc/apache2/sites-available/default-ssl",
+ require => Package["apache2"],
+ notify => Service["apache2"],
+ }
+
+ file { "/etc/apache2/conf.d/python.conf":
+ content => "DefaultInitEnv PYTHON_EGG_CACHE /tmp/eggs",
+ require => Package["apache2"],
+ notify => Service["apache2"],
+ }
+
+ exec { "prepare trac":
+ command => "echo Trac pre-requisites are installed",
+ require => Package[$requirements],
+ }
+
+}
diff --git a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/plugin.pp b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/plugin.pp
index afa92ff..6b87829 100644
--- a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/plugin.pp
+++ b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/plugin.pp
@@ -2,19 +2,23 @@ define trac::plugin(
$plugin = "$title",
$egg,
$url,
- $base = "/home/tools/trac",
+ $base = $trac::base,
) {
$srcbase = "$base/src/$plugin"
- file { "$srcbase":
- ensure => "directory",
- }
+ include "trac"
+
+ exec { "prepare $plugin":
+ command => "mkdir -p $srcbase",
+ creates => "$srcbase",
+ require => Exec["prepare trac"]
+ }
exec { "svn checkout $plugin":
command => "svn checkout $url src",
cwd => "$srcbase",
creates => "$srcbase/src",
- require => File["$srcbase"],
+ require => Exec["prepare $plugin"],
}
exec { "setup $plugin":
diff --git a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/site.pp b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/site.pp
index a5f8193..4b9f6c0 100644
--- a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/site.pp
+++ b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/site.pp
@@ -1,114 +1,136 @@
-define trac::site(
- $envid = "$title",
- $version,
- $xmlrpcplugin = "trunk",
- $accountmanagerplugin = "",
- $allbasicauth = false,
- $certauth = false,
- $digestauth = false,
- $base = "/home/tools/trac",
-) {
- $prefix = "$base/share/trac-$version"
- $envbase = "$base/var/$envid"
- $env = "$base/var/$envid/env"
- $conf = "$base/conf.d"
-
- file { "$envbase":
- ensure => "directory",
- owner => "www-data",
- }
-
- file { "$envbase/svn":
- ensure => "directory",
- require => File["$envbase"],
- owner => "www-data",
- }
-
- exec { "svn create $envid":
- command => "svnadmin create $envbase/svn",
- require => File["$envbase/svn"],
- creates => "$envbase/svn/format",
- }
-
- exec { "initenv $envid":
- command => "$base/bin/tracadmin-$version $env initenv $envid sqlite:db/trac.db svn $envbase/svn",
- creates => "$env",
- user => "www-data",
- require => Exec["svn create $envid"],
- }
-
- exec { "add admin permissions $envid":
- command => "$base/bin/tracadmin-$version $env permission add admin@mylyn.eclipse.org TRAC_ADMIN",
- user => "www-data",
- environment => "PYTHON_EGG_CACHE=/tmp/eggs",
- require => Exec["initenv $envid"],
- onlyif => "$base/bin/tracadmin-$version $env permission list admin@mylyn.eclipse.org | (grep -qE 'admin.*TRAC_ADMIN'; test $? != 0)"
- }
-
- exec { "add tests permissions $envid":
- command => "$base/bin/tracadmin-$version $env permission add tests@mylyn.eclipse.org TICKET_ADMIN TICKET_CREATE TICKET_MODIFY",
- user => "www-data",
- environment => "PYTHON_EGG_CACHE=/tmp/eggs",
- require => Exec["initenv $envid"],
- onlyif => "$base/bin/tracadmin-$version $env permission list tests@mylyn.eclipse.org | (grep -qE 'tests.*TICKET_ADMIN'; test $? != 0)"
- }
-
- exec { "add user permissions $envid":
- command => "$base/bin/tracadmin-$version $env permission add user@mylyn.eclipse.org TICKET_CREATE TICKET_MODIFY",
- user => "www-data",
- environment => "PYTHON_EGG_CACHE=/tmp/eggs",
- require => Exec["initenv $envid"],
- onlyif => "$base/bin/tracadmin-$version $env permission list user@mylyn.eclipse.org | (grep -qE 'user.*TICKET_CREATE'; test $? != 0)"
- }
-
- file { "$env/conf/trac.ini":
- content => template('trac/trac.ini.erb'),
- require => Exec["initenv $envid"],
- }
-
- file { "$conf/$envid.conf":
- content => template('trac/trac.conf.erb'),
- }
-
- if $digestauth {
- file { "$envbase/htpasswd.digest":
- content => template('trac/htpasswd.digest.erb'),
- require => File["$envbase"],
- }
- } else {
- file { "$envbase/htpasswd":
- content => template('trac/htpasswd.erb'),
- require => File["$envbase"],
- }
- }
-
- file { "$envbase/trac-$version.fcgi":
- content => template('trac/trac.fcgi.erb'),
- mode => 755,
- require => File["$envbase"],
- notify => Service["apache2"],
- }
-
- if $xmlrpcplugin {
- file { "$env/plugins/TracXMLRPC.egg":
- source => "$base/src/xmlrpcplugin-$xmlrpcplugin/src/dist/TracXMLRPC.egg",
- require => Exec["initenv $envid"],
- }
-
- exec { "add xmlrpc permissions $envid":
- command => "$base/bin/tracadmin-$version $env permission add tests@mylyn.eclipse.org XML_RPC",
- user => "www-data",
- environment => "PYTHON_EGG_CACHE=/tmp/eggs",
- require => File["$env/plugins/TracXMLRPC.egg"],
- onlyif => "$base/bin/tracadmin-$version $env permission list tests@mylyn.eclipse.org | (grep -qE 'tests.*XML_RPC'; test $? != 0)"
- }
- }
-
- if $accountmanagerplugin {
- file { "$env/plugins/TracAccountManager.egg":
- source => "$base/src/accountmanagerplugin-$accountmanagerplugin/src/dist/TracAccountManager.egg",
- require => Exec["initenv $envid"],
- }
- }
+
+define trac::site (
+ $envid = "$title",
+ $version,
+ $xmlrpcplugin = "trunk",
+ $accountmanagerplugin = "",
+ $allbasicauth = false,
+ $certauth = false,
+ $digestauth = false,
+ $base = "/home/tools/trac",) {
+
+ $prefix = "$base/share/trac-$version"
+ $envbase = "$base/var/$envid"
+ $env = "$base/var/$envid/env"
+ $conf = "$base/conf.d"
+
+ include "trac"
+
+ exec { "prepare $envbase":
+ command => "mkdir -p $base/bin $base/conf.d $base/src $base/var $envbase",
+ creates => "$envbase",
+ require => Exec["prepare trac"],
+ }
+
+ file { "$envbase":
+ ensure => "directory",
+ owner => "www-data",
+ require => Exec["prepare $envbase"],
+ }
+
+ file { "$envbase/svn":
+ ensure => "directory",
+ owner => "www-data",
+ require => File["$envbase"],
+ }
+
+ exec { "svn create $envid":
+ command => "svnadmin create $envbase/svn",
+ require => File["$envbase/svn"],
+ creates => "$envbase/svn/format",
+ }
+
+ exec { "initenv $envid":
+ command => "$base/bin/tracadmin-$version $env initenv $envid sqlite:db/trac.db svn $envbase/svn",
+ creates => "$env",
+ user => "www-data",
+ require => Exec["svn create $envid"],
+ }
+
+ exec { "add admin permissions $envid":
+ command => "$base/bin/tracadmin-$version $env permission add admin@mylyn.eclipse.org TRAC_ADMIN",
+ user => "www-data",
+ environment => "PYTHON_EGG_CACHE=/tmp/eggs",
+ require => Exec["initenv $envid"],
+ onlyif =>
+ "$base/bin/tracadmin-$version $env permission list admin@mylyn.eclipse.org | (grep -qE 'admin.*TRAC_ADMIN'; test $? != 0)"
+ }
+
+ exec { "add tests permissions $envid":
+ command =>
+ "$base/bin/tracadmin-$version $env permission add tests@mylyn.eclipse.org TICKET_ADMIN TICKET_CREATE TICKET_MODIFY",
+ user => "www-data",
+ environment => "PYTHON_EGG_CACHE=/tmp/eggs",
+ require => Exec["initenv $envid"],
+ onlyif =>
+ "$base/bin/tracadmin-$version $env permission list tests@mylyn.eclipse.org | (grep -qE 'tests.*TICKET_ADMIN'; test $? != 0)"
+ }
+
+ exec { "add user permissions $envid":
+ command => "$base/bin/tracadmin-$version $env permission add user@mylyn.eclipse.org TICKET_CREATE TICKET_MODIFY",
+ user => "www-data",
+ environment => "PYTHON_EGG_CACHE=/tmp/eggs",
+ require => Exec["initenv $envid"],
+ onlyif =>
+ "$base/bin/tracadmin-$version $env permission list user@mylyn.eclipse.org | (grep -qE 'user.*TICKET_CREATE'; test $? != 0)"
+ }
+
+ file { "$env/conf/trac.ini":
+ content => template('trac/trac.ini.erb'),
+ require => Exec["initenv $envid"],
+ }
+
+ file { "$conf/$envid.conf":
+ content => template('trac/trac.conf.erb'),
+ require => Exec["prepare $envbase"],
+ }
+
+ if $digestauth {
+ file { "$envbase/htpasswd.digest":
+ content => template('trac/htpasswd.digest.erb'),
+ require => File["$envbase"],
+ }
+ } else {
+ file { "$envbase/htpasswd":
+ content => template('trac/htpasswd.erb'),
+ require => File["$envbase"],
+ }
+ }
+
+ file { "$envbase/trac-$version.fcgi":
+ content => template('trac/trac.fcgi.erb'),
+ mode => 755,
+ require => File["$envbase"],
+ }
+
+ if $xmlrpcplugin {
+ file { "$env/plugins/TracXMLRPC.egg":
+ source => "$base/src/xmlrpcplugin-$xmlrpcplugin/src/dist/TracXMLRPC.egg",
+ require => Exec["initenv $envid"],
+ }
+
+ exec { "add xmlrpc permissions $envid":
+ command => "$base/bin/tracadmin-$version $env permission add tests@mylyn.eclipse.org XML_RPC",
+ user => "www-data",
+ environment => "PYTHON_EGG_CACHE=/tmp/eggs",
+ require => File["$env/plugins/TracXMLRPC.egg"],
+ onlyif =>
+ "$base/bin/tracadmin-$version $env permission list tests@mylyn.eclipse.org | (grep -qE 'tests.*XML_RPC'; test $? != 0)"
+ }
+ }
+
+ if $accountmanagerplugin {
+ file { "$env/plugins/TracAccountManager.egg":
+ source => "$base/src/accountmanagerplugin-$accountmanagerplugin/src/dist/TracAccountManager.egg",
+ require => Exec["initenv $envid"],
+ }
+ }
+
+ exec { "add $envbase to /etc/apache2/conf.d/trac.conf":
+ command => "echo 'Include $base/conf.d/[^.#]*\n' >> /etc/apache2/conf.d/trac.conf",
+ require => File["$conf/$envid.conf"],
+ notify => Service["apache2"],
+ onlyif => "grep -qe '^Include $base/conf.d' /etc/apache2/conf.d/trac.conf; test $? != 0"
+ }
}
diff --git a/org.eclipse.mylyn.trac.releng/modules/trac/manifests/trac.pp b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/trac.pp
new file mode 100644
index 0000000..5637022
--- /dev/null
+++ b/org.eclipse.mylyn.trac.releng/modules/trac/manifests/trac.pp
@@ -0,0 +1,67 @@
+/* Instance specific provisioning */
+
+define trac::trac ($version = "$title", $base = $trac::base,) {
+ $binbase = "$base/bin"
+ $srcbase = "$base/src/trac-$version"
+ $prefix = "$base/share/trac-$version"
+
+ include "trac"
+
+ exec { "prepare $version":
+ command => "mkdir -p $binbase $srcbase $prefix",
+ creates => [ "$binbase", "$srcbase", "$prefix" ],
+ require => Exec["prepare trac"]
+ }
+
+ file { "$srcbase":
+ ensure => "directory",
+ require => Exec["prepare $version"],
+ }
+
+ if $version == "trunk" {
+ exec { "extract trac $version":
+ command => "svn checkout http://svn.edgewall.org/repos/trac/trunk Trac-trunk",
+ cwd => "$srcbase",
+ creates => "$srcbase/Trac-$version",
+ require => File["$srcbase"],
+ }
+ } else {
+ exec { "download trac $version":
+ command => "wget -O $srcbase/Trac-$version.tar.gz http://download.edgewall.org/trac/Trac-$version.tar.gz",
+ creates => "$srcbase/Trac-$version.tar.gz",
+ require => File["$srcbase"],
+ }
+
+ exec { "extract trac $version":
+ command => "tar -C $srcbase -xzvf $srcbase/Trac-$version.tar.gz",
+ require => Exec["download trac $version"],
+ creates => "$srcbase/Trac-$version",
+ }
+ }
+
+ file { "$srcbase/install.sh":
+ source => "puppet:///modules/trac/install.sh",
+ mode => '755',
+ }
+
+ exec { "install $version":
+ command => "$srcbase/install.sh $srcbase/Trac-$version $prefix $version",
+ path => ".",
+ logoutput => false,
+ require => Exec["extract trac $version"],
+ creates => "$prefix/lib/.provisioned",
+ }
+
+ file { "$binbase/trac-$version.cgi":
+ content => template('trac/trac.cgi.erb'),
+ require => Exec["prepare $version"],
+ mode => 755,
+ }
+
+ file { "$binbase/tracadmin-$version":
+ content => template('trac/tracadmin.erb'),
+ mode => 755,
+ require => Exec["prepare $version"]
+ }
+
+} \ No newline at end of file