summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2013-02-02 15:09:06 (EST)
committerSteffen Pingel2013-02-02 15:09:06 (EST)
commit85cf30f15ea6a8c9f7242778af9c9faa4834e3e6 (patch)
tree7221069f07079512b7f107efc62e618b13d1a3de
parent2dc724ee889d96d4c6c6e69db1401e069b99ce46 (diff)
downloadorg.eclipse.mylyn.tasks-85cf30f15ea6a8c9f7242778af9c9faa4834e3e6.zip
org.eclipse.mylyn.tasks-85cf30f15ea6a8c9f7242778af9c9faa4834e3e6.tar.gz
org.eclipse.mylyn.tasks-85cf30f15ea6a8c9f7242778af9c9faa4834e3e6.tar.bz2
394052: support parameterizing Bugzilla puppet scriptsrefs/changes/29/10129/1
Change-Id: I8a238c70492137b3126de45f6e9381f4dcec21ce Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=394052
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/manifests/default.pp99
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/index.php3
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp163
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp238
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp231
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb4
6 files changed, 358 insertions, 380 deletions
diff --git a/org.eclipse.mylyn.bugzilla.releng/manifests/default.pp b/org.eclipse.mylyn.bugzilla.releng/manifests/default.pp
index 9eae8c6..6aacc20 100644
--- a/org.eclipse.mylyn.bugzilla.releng/manifests/default.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/manifests/default.pp
@@ -12,99 +12,14 @@
Exec {
path => ["/bin/", "/sbin/", "/usr/bin/", "/usr/sbin/"] }
-class bugzilla {
- $dbuser = 'bugz'
- $dbuserPassword = 'ovlwq8'
+include "bugzilla"
- $bugzillaBase = "/home/tools/bugzilla"
- $installHelper = "$bugzillaBase/installHelper"
- $installLog = "$bugzillaBase/installLog"
- $confDir = "$bugzillaBase/conf.d"
- $userOwner = "tools"
- $userGroup = "tools"
-
- exec { "apt-get update":
- command => "apt-get update",
- onlyif => "find /var/lib/apt/lists/ -mtime -7 | (grep -q Package; [ $? != 0 ])",
- }
-
- user { "tools":
- ensure => present,
- membership => minimum,
- shell => "/bin/bash",
- managehome => 'true',
+user { "tools":
+ ensure => present,
+ membership => minimum,
+ shell => "/bin/bash",
+ managehome => true,
}
- bugzilla::defaultsites { "bugzilla":
- }
-
- bugzillaVersion { "bugs36":
- major => "3",
- minor => "6",
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugs36-custom-wf":
- major => "3",
- minor => "6",
- branch => "3.6",
- bugz_dbname => "bugs_3_6_cwf",
- custom_wf => true,
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugs36-custom-wf-and-status":
- major => "3",
- minor => "6",
- branch => "3.6",
- bugz_dbname => "bugs_3_6_cwf_ws",
- custom_wf_and_status => true,
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugs36-xml-rpc-disabled":
- major => "3",
- minor => "6",
- branch => "3.6",
- bugz_dbname => "bugs_3_6_norpc",
- xmlrpc_enabled => false,
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugs40":
- major => "4",
- minor => "0",
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugs42":
- major => "4",
- minor => "2",
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugs44":
- major => "4",
- minor => "4",
- branchTag => "trunk",
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- bugzillaVersion { "bugshead":
- major => "4",
- minor => "5",
- branch => "trunk",
- branchTag => "trunk",
- bugz_dbname => "bugs_head",
- require => [Service["mysql"], Exec["mysql-create-user-${dbuser}"]]
- }
-
- file { "/etc/apache2/conf.d/bugzilla.conf":
- content => "Include /home/tools/bugzilla/conf.d/[^.#]*\n",
- require => Package["apache2"],
- notify => Service["apache2"],
- }
-
+bugzilla::defaultsites { "bugzilla":
}
-
-include bugzilla
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/index.php b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/index.php
deleted file mode 100644
index bd7699f..0000000
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/index.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-echo "THIS PAGE IS MANAGED BY PUPPET !!!";
-?>
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
index 24cc03a..53c7a9f 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
@@ -10,145 +10,58 @@
* Steffen Pingel (Tasktop Techologies)
*******************************************************************************/
define bugzilla::defaultsites {
-
- $requirements = [
- "apache2",
- "apache2.2-common",
- "libapache2-mod-auth-mysql",
- "libapache2-mod-fcgid",
- "libapache2-mod-php5",
- "mysql-server",
- "bzr",
- "make",
- "perl-doc",
- "php5",
- "php5-mysql",
- "phpmyadmin",
- "libcgi-pm-perl",
- "libdbd-mysql-perl",
- "libdatetime-perl",
- "libdatetime-timezone-perl",
- "libemail-mime-perl",
- "libemail-send-perl",
- "libjson-rpc-perl",
- "libmail-sendmail-perl",
- "libmath-random-isaac-perl",
- "libtest-taint-perl",
- "liburi-perl",
- "libsoap-lite-perl",
- "libtemplate-perl",]
-
- package { $requirements:
- ensure => "installed",
- require => Exec["apt-get update"],
- }
-
- exec { "Enable php5 module":
- command => "a2enmod php5",
- require => Package["libapache2-mod-php5"],
- creates => "/etc/apache2/mods-enabled/php5.load",
- }
-
- 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",
- }
-
- service { "mysql":
- ensure => "running",
- enable => true,
- require => Package["mysql-server"],
- }
-
- exec { "phpmyadmin_Apache2":
- command => "echo '#phpmyadmin\nInclude /etc/phpmyadmin/apache.conf' >>/etc/apache2/apache2.conf",
- require => [Package["phpmyadmin"], Package["libapache2-mod-php5"]],
- unless => 'cat /etc/apache2/apache2.conf | grep "#phpmyadmin"'
+
+ bugzilla::site { "bugs36":
+ major => "3",
+ minor => "6",
}
- file { "/etc/apache2/sites-enabled/001-default-ssl":
- ensure => link,
- target => "/etc/apache2/sites-available/default-ssl",
+ bugzilla::site { "bugs36-custom-wf":
+ major => "3",
+ minor => "6",
+ branch => "3.6",
+ bugz_dbname => "bugs_3_6_cwf",
+ custom_wf => true,
}
- exec { "create $bugzilla::bugzillaBase":
- command => "mkdir -p $bugzilla::bugzillaBase",
- creates => "$bugzilla::bugzillaBase",
- user => "$bugzilla::userOwner",
- require => Exec['phpmyadmin_Apache2']
+ bugzilla::site { "bugs36-custom-wf-and-status":
+ major => "3",
+ minor => "6",
+ branch => "3.6",
+ bugz_dbname => "bugs_3_6_cwf_ws",
+ custom_wf_and_status => true,
}
- exec { "create $bugzilla::installHelper":
- command => "mkdir $bugzilla::installHelper",
- creates => "$bugzilla::installHelper",
- user => "$bugzilla::userOwner",
- require => Exec["create $bugzilla::bugzillaBase"]
+ bugzilla::site { "bugs36-xml-rpc-disabled":
+ major => "3",
+ minor => "6",
+ branch => "3.6",
+ bugz_dbname => "bugs_3_6_norpc",
+ xmlrpc_enabled => false,
}
- exec { "create $bugzilla::confDir":
- command => "mkdir $bugzilla::confDir",
- creates => "$bugzilla::confDir",
- user => "$bugzilla::userOwner",
- require => Exec["create $bugzilla::bugzillaBase"]
+ bugzilla::site { "bugs40":
+ major => "4",
+ minor => "0",
}
- exec { "create $bugzilla::installLog":
- command => "mkdir $bugzilla::installLog",
- creates => "$bugzilla::installLog",
- user => "$bugzilla::userOwner",
- require => Exec["create $bugzilla::bugzillaBase"]
+ bugzilla::site { "bugs42":
+ major => "4",
+ minor => "2",
}
- exec { "mysql-create-user-${bugzilla::dbuser}":
- unless => "/usr/bin/mysql --user='${bugzilla::dbuser}' --password='${bugzilla::dbuserPassword}'",
- command =>
- "/usr/bin/mysql -v --user='root' -e \"CREATE USER '${bugzilla::dbuser}'@localhost IDENTIFIED BY '${bugzilla::dbuserPassword}'\"",
- logoutput => true,
- require => [
- Package["mysql-server"],
- Exec["create $bugzilla::installHelper"],
- Exec["create $bugzilla::installLog"],
- Package[$requirements]]
+ bugzilla::site { "bugs44":
+ major => "4",
+ minor => "4",
+ branchTag => "trunk",
}
- file { "/var/www/index.php":
- notify => Service["apache2"],
- ensure => "present",
- source => "puppet:///modules/bugzilla/index.php",
- owner => "root",
- group => "root",
- mode => 644,
- require => [Package["apache2"], Package["php5"]],
+ bugzilla::site { "bugshead":
+ major => "4",
+ minor => "5",
+ branch => "trunk",
+ branchTag => "trunk",
+ bugz_dbname => "bugs_head",
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp
index 8ab89c1..fda6ba1 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp
@@ -9,189 +9,111 @@
* Frank Becker - initial API and implementation
* Steffen Pingel (Tasktop Techologies)
*******************************************************************************/
-define bugzillaVersion (
- $major,
- $minor,
- $branch = " ",
- $bugz_dbname = "$title",
- $www_url = "$title",
- $version = "$title",
- $branchTag = "bugzilla-stable",
- $custom_wf = false,
- $custom_wf_and_status = false,
- $xmlrpc_enabled = true,
- $base = "/home/tools/bugzilla",
- $envtype = "bugzilla",
- $envid = "$title",
- ) {
+class bugzilla {
+ $bugzillaBase = "/home/tools/bugzilla"
+ $userOwner = "tools"
+ $userGroup = "tools"
+ $dbuser = 'bugz'
+ $dbuserPassword = 'ovlwq8'
- if $branch == "trunk" {
- $envinfo = "trunk"
- } else {
- if $xmlrpc_enabled {
- if $custom_wf {
- $envinfo = "Custom Workflow"
- } else {
- if $custom_wf_and_status {
- $envinfo = "Custom Workflow and Status"
- } else {
- $envinfo = ""
- }
- }
- } else {
- $envinfo = "XML-RPC disabled"
- }
- }
- if $major == "3" {
- if $minor == "6" {
- $VersionCreateName = "name"
- } else {
- $VersionCreateName = "value"
- }
- } else {
- $VersionCreateName = "value"
- }
-
- if ($branch == "trunk") {
- $branchName = "$branch"
- } else {
- $branchName = "${major}.${minor}"
+ exec { "apt-get update":
+ command => "apt-get update",
+ onlyif => "find /var/lib/apt/lists/ -mtime -7 | (grep -q Package; [ $? != 0 ])",
}
- if $branchTag == "trunk" {
- exec { "extract bugzilla $version":
- command => "bzr co bzr://bzr.mozilla.org/bugzilla/$branchName $version",
- cwd => "$base",
- user => "$bugzilla::userOwner",
- timeout => 300,
- creates => "$base/$version",
- }
-
- # we need a extras setup because for bughead we need
- # template 2.24 but libtemplate-perl from precise32 is only 2.22
- exec { "post extract bugzilla $version":
- command => "/usr/bin/perl install-module.pl Template >$base/$version/extra.out",
- cwd => "$base/$version",
- creates => "$base/$version/extra.out",
- user => "$bugzilla::userOwner",
- timeout => 300,
- require => Exec["extract bugzilla $version"]
- }
- } else {
- exec { "extract bugzilla $version":
- command => "bzr co -r tag:$branchTag bzr://bzr.mozilla.org/bugzilla/$branchName $version",
- cwd => "$base",
- user => "$bugzilla::userOwner",
- timeout => 300,
- creates => "$base/$version",
- }
+ $requirements = [
+ "apache2",
+ "apache2.2-common",
+ "libapache2-mod-auth-mysql",
+ "libapache2-mod-fcgid",
+ "libapache2-mod-php5",
+ "mysql-server",
+ "bzr",
+ "make",
+ "perl-doc",
+ "php5",
+ "php5-mysql",
+ "phpmyadmin",
+ "libcgi-pm-perl",
+ "libdbd-mysql-perl",
+ "libdatetime-perl",
+ "libdatetime-timezone-perl",
+ "libemail-mime-perl",
+ "libemail-send-perl",
+ "libjson-rpc-perl",
+ "libmail-sendmail-perl",
+ "libmath-random-isaac-perl",
+ "libtest-taint-perl",
+ "liburi-perl",
+ "libsoap-lite-perl",
+ "libtemplate-perl",]
- # we need no extras setup because for bugzilla <= 4.4 all
- # perl libs have the correct version
- exec { "post extract bugzilla $version":
- command => "ls >$base/$version/extra.out",
- cwd => "$base/$version",
- creates => "$base/$version/extra.out",
- user => "$bugzilla::userOwner",
- timeout => 300,
- require => Exec["extract bugzilla $version"]
- }
+ package { $requirements:
+ ensure => "installed",
+ require => Exec["apt-get update"],
}
- exec { "mysql-grant-${bugz_dbname}-${bugzilla::dbuser}":
- unless =>
- "/usr/bin/mysql --user=root --batch -e \"SELECT user FROM db WHERE Host='localhost' and Db='${bugz_dbname}' and User='${bugzilla::dbuser}'\" mysql | /bin/grep '${bugzilla::dbuser}'",
- command => "/usr/bin/mysql --verbose --user=root -e \"GRANT ALL ON ${bugz_dbname}.* TO '${bugzilla::dbuser}'@localhost\" \
- ; /usr/bin/mysqladmin --verbose --user=root flush-privileges",
-## logoutput => true,
- require => Exec["post extract bugzilla $version"]
+ exec { "Enable php5 module":
+ command => "a2enmod php5",
+ require => Package["libapache2-mod-php5"],
+ creates => "/etc/apache2/mods-enabled/php5.load",
}
- exec { "mysql-dropdb-$version":
- onlyif => "/usr/bin/mysql --user=root '${bugz_dbname}'",
- command => "/usr/bin/mysqladmin -v --user=root --force drop '${bugz_dbname}'",
-## logoutput => true,
- require => Exec["mysql-grant-${bugz_dbname}-${bugzilla::dbuser}"]
+ service { "apache2":
+ ensure => running,
+ require => Package["apache2"],
}
- exec { "mysql-createdb-$version":
- unless => "/usr/bin/mysql --user=root '${bugz_dbname}'",
- command => "/usr/bin/mysqladmin -v --user=root --force create '${bugz_dbname}'",
-## logoutput => true,
- require => Exec["mysql-dropdb-$version"]
+ exec { "Enable auth_digest module":
+ command => "a2enmod auth_digest",
+ require => Package["apache2"],
+ creates => "/etc/apache2/mods-enabled/auth_digest.load",
}
- file { "$bugzilla::installHelper/answers$version":
- content => template('bugzilla/answers.erb'),
- owner => "$bugzilla::userOwner",
- group => "$bugzilla::userGroup",
- require => Exec["post extract bugzilla $version"],
+ exec { "Enable fcgid module":
+ command => "a2enmod fcgid",
+ require => Package["libapache2-mod-fcgid"],
+ creates => "/etc/apache2/mods-enabled/fcgid.load",
}
- file { "$base/$version/extensions/Mylyn":
- ensure => directory, # so make this a directory
- recurse => true, # enable recursive directory management
- purge => true, # purge all unmanaged junk
- force => true, # also purge subdirs and links etc.
- owner => "$bugzilla::userOwner",
- group => "$bugzilla::userGroup",
- source => "puppet:///modules/bugzilla/extensions/Mylyn",
- require => Exec["post extract bugzilla $version"],
+ exec { "Enable proxy mod":
+ command => "a2enmod proxy",
+ require => Package["apache2"],
+ creates => "/etc/apache2/mods-enabled/proxy.load",
}
- file { "$base/$version/extensions/Mylyn/Extension.pm":
- content => template('bugzilla/Extension.pm.erb'),
- require => FILE["$base/$version/extensions/Mylyn"],
- owner => "$bugzilla::userOwner",
- group => "$bugzilla::userGroup",
- mode => 0644,
+ exec { "Enable proxy_http mod":
+ command => "a2enmod proxy_http",
+ require => Package["apache2"],
+ creates => "/etc/apache2/mods-enabled/proxy_http.load",
}
- exec { "init bugzilla_checksetup $version":
- command => "$base/$version/checksetup.pl $bugzilla::installHelper/answers$version -verbose",
- cwd => "$base/$version",
- creates => "$base/$version/localconfig",
- user => "$bugzilla::userOwner",
- require => [
- EXEC["mysql-createdb-$version"],
- File["$bugzilla::installHelper/answers$version"],
- FILE["$base/$version/extensions/Mylyn/Extension.pm"]]
+ exec { "Enable ssl module":
+ command => "a2enmod ssl",
+ require => Package["apache2"],
+ creates => "/etc/apache2/mods-enabled/ssl.load",
}
- exec { "update bugzilla_checksetup $version":
- command => "$base/$version/checksetup.pl $bugzilla::installHelper/answers$version -verbose",
- cwd => "$base/$version",
- user => "$bugzilla::userOwner",
-## logoutput => true,
- require => [
- EXEC["mysql-createdb-$version"],
- EXEC["init bugzilla_checksetup $version"],
- File["$bugzilla::installHelper/answers$version"],
- FILE["$base/$version/extensions/Mylyn/Extension.pm"]]
+ service { "mysql":
+ ensure => "running",
+ enable => true,
+ require => Package["mysql-server"],
}
- if !$xmlrpc_enabled {
- file { "$base/$version/xmlrpc.cgi":
- content => template('bugzilla/xmlrpc.cgi.erb'),
- owner => "$bugzilla::userOwner",
- group => "$bugzilla::userGroup",
- mode => 755,
- require => Exec["update bugzilla_checksetup $version"],
- }
+ exec { "phpmyadmin_Apache2":
+ command => "echo '#phpmyadmin\nInclude /etc/phpmyadmin/apache.conf' >>/etc/apache2/apache2.conf",
+ require => [Package["phpmyadmin"], Package["libapache2-mod-php5"]],
+ unless => 'cat /etc/apache2/apache2.conf | grep "#phpmyadmin"'
}
- file { "$base/$version/service.json":
- content => template('bugzilla/service.json.erb'),
- owner => "$bugzilla::userOwner",
- group => "$bugzilla::userGroup",
- mode => 644,
- require => Exec["update bugzilla_checksetup $version"],
+ file { "/etc/apache2/sites-enabled/001-default-ssl":
+ ensure => link,
+ target => "/etc/apache2/sites-available/default-ssl",
}
- file { "$bugzilla::confDir/$version.conf":
- content => template('bugzilla/apache2.conf.erb'),
- require => [Package["apache2"], EXEC["update bugzilla_checksetup $version"]],
- notify => Service["apache2"],
+ exec { "prepare bugzilla":
+ command => "echo Bugzilla pre-requisites are installed",
+ require => Package[$requirements],
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
new file mode 100644
index 0000000..7042143
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ * Steffen Pingel (Tasktop Techologies)
+ *******************************************************************************/
+define bugzilla::site (
+ $major,
+ $minor,
+ $branch = " ",
+ $bugz_dbname = "$title",
+ $bugz_user = $bugzilla::dbuser,
+ $bugz_password = $bugzilla::dbuserPassword,
+ $www_url = "$title",
+ $version = "$title",
+ $branchTag = "bugzilla-stable",
+ $custom_wf = false,
+ $custom_wf_and_status = false,
+ $xmlrpc_enabled = true,
+ $base = $bugzilla::bugzillaBase,
+ $envtype = "bugzilla",
+ $envid = "$title",
+ $userOwner = $bugzilla::userOwner,
+ $userGroup = $bugzilla::userGroup,
+ ) {
+
+ include "bugzilla"
+
+ $installHelper = "$base/installHelper"
+ $installLog = "$base/installLog"
+ $confDir = "$base/conf.d"
+
+ if $branch == "trunk" {
+ $envinfo = "trunk"
+ } else {
+ if $xmlrpc_enabled {
+ if $custom_wf {
+ $envinfo = "Custom Workflow"
+ } else {
+ if $custom_wf_and_status {
+ $envinfo = "Custom Workflow and Status"
+ } else {
+ $envinfo = ""
+ }
+ }
+ } else {
+ $envinfo = "XML-RPC disabled"
+ }
+ }
+ if $major == "3" {
+ if $minor == "6" {
+ $VersionCreateName = "name"
+ } else {
+ $VersionCreateName = "value"
+ }
+ } else {
+ $VersionCreateName = "value"
+ }
+
+ if ($branch == "trunk") {
+ $branchName = "$branch"
+ } else {
+ $branchName = "${major}.${minor}"
+ }
+
+
+ exec { "prepare $version":
+ command => "mkdir -p $installHelper $installLog $confDir",
+ creates => "$base",
+ user => "$userOwner",
+ require => Exec["prepare bugzilla"],
+ }
+
+ exec { "mysql create user ${bugz_user} for $version":
+ unless => "/usr/bin/mysql --user='${bugz_user}' --password='${bugz_password}'",
+ command => "/usr/bin/mysql -v --user='root' -e \"CREATE USER '${bugz_user}'@localhost IDENTIFIED BY '${bugz_password}'\"",
+ logoutput => true,
+ require => Package["mysql-server"],
+ }
+
+ if $branchTag == "trunk" {
+ exec { "extract bugzilla $version":
+ command => "bzr co bzr://bzr.mozilla.org/bugzilla/$branchName $version",
+ cwd => "$base",
+ user => "$userOwner",
+ timeout => 300,
+ creates => "$base/$version",
+ require => Exec["prepare $version"]
+ }
+
+ # we need a extras setup because for bughead we need
+ # template 2.24 but libtemplate-perl from precise32 is only 2.22
+ exec { "post extract bugzilla $version":
+ command => "/usr/bin/perl install-module.pl Template >$base/$version/extra.out",
+ cwd => "$base/$version",
+ creates => "$base/$version/extra.out",
+ user => "$userOwner",
+ timeout => 300,
+ require => Exec["extract bugzilla $version"]
+ }
+ } else {
+ exec { "extract bugzilla $version":
+ command => "bzr co -r tag:$branchTag bzr://bzr.mozilla.org/bugzilla/$branchName $version",
+ cwd => "$base",
+ user => "$userOwner",
+ timeout => 300,
+ creates => "$base/$version",
+ require => Exec["prepare $version"]
+ }
+
+ # we need no extras setup because for bugzilla <= 4.4 all
+ # perl libs have the correct version
+ exec { "post extract bugzilla $version":
+ command => "ls >$base/$version/extra.out",
+ cwd => "$base/$version",
+ creates => "$base/$version/extra.out",
+ user => "$userOwner",
+ timeout => 300,
+ require => Exec["extract bugzilla $version"]
+ }
+ }
+
+ exec { "mysql-grant-${bugz_dbname}-${bugzilla::dbuser}":
+ unless =>
+ "/usr/bin/mysql --user=root --batch -e \"SELECT user FROM db WHERE Host='localhost' and Db='${bugz_dbname}' and User='${bugzilla::dbuser}'\" mysql | /bin/grep '${bugzilla::dbuser}'",
+ command => "/usr/bin/mysql --verbose --user=root -e \"GRANT ALL ON ${bugz_dbname}.* TO '${bugzilla::dbuser}'@localhost\" \
+ ; /usr/bin/mysqladmin --verbose --user=root flush-privileges",
+## logoutput => true,
+ require => Exec["post extract bugzilla $version"]
+ }
+
+ exec { "mysql-dropdb-$version":
+ onlyif => "/usr/bin/mysql --user=root '${bugz_dbname}'",
+ command => "/usr/bin/mysqladmin -v --user=root --force drop '${bugz_dbname}'",
+## logoutput => true,
+ require => Exec["mysql-grant-${bugz_dbname}-${bugzilla::dbuser}"]
+ }
+
+ exec { "mysql-createdb-$version":
+ unless => "/usr/bin/mysql --user=root '${bugz_dbname}'",
+ command => "/usr/bin/mysqladmin -v --user=root --force create '${bugz_dbname}'",
+## logoutput => true,
+ require => Exec["mysql-dropdb-$version"]
+ }
+
+ file { "$installHelper/answers$version":
+ content => template('bugzilla/answers.erb'),
+ owner => "$userOwner",
+ group => "$userGroup",
+ require => Exec["post extract bugzilla $version"],
+ }
+
+ file { "$base/$version/extensions/Mylyn":
+ ensure => directory, # so make this a directory
+ recurse => true, # enable recursive directory management
+ purge => true, # purge all unmanaged junk
+ force => true, # also purge subdirs and links etc.
+ owner => "$userOwner",
+ group => "$userGroup",
+ source => "puppet:///modules/bugzilla/extensions/Mylyn",
+ require => Exec["post extract bugzilla $version"],
+ }
+
+ file { "$base/$version/extensions/Mylyn/Extension.pm":
+ content => template('bugzilla/Extension.pm.erb'),
+ require => File["$base/$version/extensions/Mylyn"],
+ owner => "$userOwner",
+ group => "$userGroup",
+ mode => 0644,
+ }
+
+ exec { "init bugzilla_checksetup $version":
+ command => "$base/$version/checksetup.pl $installHelper/answers$version -verbose",
+ cwd => "$base/$version",
+ creates => "$base/$version/localconfig",
+ user => "$userOwner",
+ require => [
+ Exec["mysql-createdb-$version"],
+ File["$installHelper/answers$version"],
+ File["$base/$version/extensions/Mylyn/Extension.pm"]]
+ }
+
+ exec { "update bugzilla_checksetup $version":
+ command => "$base/$version/checksetup.pl $installHelper/answers$version -verbose",
+ cwd => "$base/$version",
+ user => "$userOwner",
+## logoutput => true,
+ require => [
+ Exec["mysql-createdb-$version"],
+ Exec["init bugzilla_checksetup $version"],
+ File["$installHelper/answers$version"],
+ File["$base/$version/extensions/Mylyn/Extension.pm"]]
+ }
+
+ if !$xmlrpc_enabled {
+ file { "$base/$version/xmlrpc.cgi":
+ content => template('bugzilla/xmlrpc.cgi.erb'),
+ owner => "$userOwner",
+ group => "$userGroup",
+ mode => 755,
+ require => Exec["update bugzilla_checksetup $version"],
+ }
+ }
+
+ file { "$base/$version/service.json":
+ content => template('bugzilla/service.json.erb'),
+ owner => "$userOwner",
+ group => "$userGroup",
+ mode => 644,
+ require => Exec["update bugzilla_checksetup $version"],
+ }
+
+ file { "$confDir/$version.conf":
+ content => template('bugzilla/apache2.conf.erb'),
+ require => [Package["apache2"], Exec["update bugzilla_checksetup $version"]],
+ notify => Service["apache2"],
+ }
+
+ exec { "add $version to /etc/apache2/conf.d/bugzilla.conf":
+ command => "echo 'Include $base/conf.d/[^.#]*\n' >> /etc/apache2/conf.d/bugzilla.conf",
+ require => File["$confDir/$version.conf"],
+ notify => Service["apache2"],
+ onlyif => "grep -qe '^Include $base/conf.d' /etc/apache2/conf.d/bugzilla.conf; test $? != 0"
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
index 50a6b10..7ed97ed 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
@@ -3,8 +3,8 @@ $answer{'db_host'} = 'localhost';
$answer{'db_driver'} = 'mysql';
$answer{'db_port'} = 0;
$answer{'db_name'} = '<%= @bugz_dbname %>';
-$answer{'db_user'} = '<%= @dbuser %>';
-$answer{'db_pass'} = '<%= @dbuserPassword %>';
+$answer{'db_user'} = '<%= @bugz_user %>';
+$answer{'db_pass'} = '<%= @bugz_password %>';
$answer{'urlbase'} = '';
$answer{'ADMIN_OK'} = 'Y';
$answer{'ADMIN_EMAIL'} = 'admin@mylyn.eclipse.org';