Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Migrated to git for upload to github. Cleanup ready for puppet forge.

  • Loading branch information...
commit c2af8f1bdcd6151bc57d028385ccb245e845fbef 0 parents
@kbarber kbarber authored
2  Modulefile
@@ -0,0 +1,2 @@
+name 'kbarber-bugzilla'
+version '1.0.0'
4 README
@@ -0,0 +1,4 @@
+This module is designed to help manage bugzilla and creation of bugzilla
+projects.
+
+See the tests directory for examples on how to use it.
41 manifests/init.pp
@@ -0,0 +1,41 @@
+# Bugzilla is a Web-based general-purpose bugtracker and testing tool
+# originally developed and used by the Mozilla project, and licensed under the
+# Mozilla Public License.
+#
+# This class is designed to install and setup Bugzilla.
+class bugzilla {
+ $res = "bugzilla"
+
+ # These are the requirements for running a fully-functional bugzilla
+ # The package should do this perhaps, but they are optional.
+ package {
+ [
+ "bugzilla",
+
+ # The following list was working out using checksetup.pl
+ "perl-GD",
+ "perl-Chart",
+ "perl-Template-GD",
+ "perl-GDTextUtil",
+ "perl-GDGraph",
+ "perl-XML-Twig",
+ "perl-MIME-tools",
+ "perl-PatchReader",
+ "ImageMagick-perl",
+ "perl-Authen-SASL",
+ "perl-Authen-Radius",
+ "perl-HTML-Scrubber",
+ "perl-TheSchwartz",
+ "perl-Daemon-Generic",
+ ]:
+ ensure => installed
+ }
+
+ # Create a dir for puppet to work with config
+ file {"/etc/bugzilla/.puppet":
+ ensure => directory,
+ mode => 0755,
+ owner => "root",
+ group => "root"
+ }
+}
131 manifests/project.pp
@@ -0,0 +1,131 @@
+# This resource is designed to manage Bugzilla projects.
+#
+# == Parameters
+#
+# [*create_htaccess*]
+# create necessary .htaccess files to lock down bugzilla
+# [*webservergroup*]
+# group that apache runs as
+# [*db_driver*]
+# driver to use for db access. Mysql is the default.
+# [*db_host*]
+# host for db
+# [*db_name*]
+# db name
+# [*db_user*]
+# who we connect to the database as
+# [*db_pass*]
+# DB user password.
+# [*db_port*]
+# Port to connect to database. 0 is default.
+# [*db_sock*]
+# Socket to connect to database. Will default to the drivers default.
+# [*db_check*]
+# Should checksetup.pl try to verify that your database setup is correct?
+# [*index_html*]
+# Create an index.html file.
+# [*cvsbin*]
+# Locion of cvs binary
+# [*interdiffbin*]
+# Location of interdiff binary
+# [*diffpath*]
+# Location of diff home (/usr/bin/)
+# [*site_wide_secret*]
+# Set the site wide secret
+define bugzilla::project (
+ $admin_email,
+ $admin_password,
+ $admin_realname,
+ $create_htaccess = false,
+ $webservergroup = 'apache',
+ $db_driver = 'mysql',
+ $db_host = 'localhost',
+ $db_name = 'bugzilla',
+ $db_user = 'bugzilla',
+ $db_pass = '',
+ $db_port = 0,
+ $db_sock = '',
+ $db_check = true,
+ $index_html = false,
+ $cvsbin = '/usr/bin/cvs',
+ $interdiffbin = '/usr/bin/interdiff',
+ $diffpath = '/usr/bin',
+ $site_wide_secret = '',
+ $smtp_server = 'localhost'
+) {
+
+ require("bugzilla")
+
+ $bz_confdir = "/etc/bugzilla/"
+ case $name {
+ "main": {
+ $localconfigfile = "${bz_confdir}localconfig"
+ $backupconfigfile = "${bz_confdir}.puppet/localconfig"
+ $answerconfigfile = "${bz_confdir}.puppet/answer"
+ $envexport = "DUMMY=foo"
+ }
+ /(.*)/: {
+ $localconfigfile = "${bz_confdir}localconfig.${name}"
+ $backupconfigfile = "${bz_confdir}.puppet/localconfig.${name}"
+ $answerconfigfile = "${bz_confdir}.puppet/answer.${name}"
+ $envexport = "PROJECT=${name}"
+ }
+ }
+
+ # Perform configuration and run checksetup.pl which will build the db
+ # if required.
+ file {$answerconfigfile:
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ content => template('bugzilla/answer.erb'),
+ notify => Exec["bugzilla_checksetup_${name}"]
+ }
+ exec{"bugzilla_checksetup_${name}":
+ command => "/usr/share/bugzilla/checksetup.pl ${answerconfigfile}",
+ logoutput => true,
+ refreshonly => true,
+ notify => Exec["backup_localconfigfile_${name}"],
+ }
+ exec{"backup_localconfigfile_${name}":
+ command => "/bin/cp ${localconfigfile} ${backupconfigfile}",
+ logoutput => true,
+ refreshonly => true,
+ }
+ file {$backupconfigfile:
+ ensure => present
+ }
+ file {$localconfigfile:
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ ensure => present,
+ source => $backupconfigfile,
+ require => Exec["backup_localconfigfile_${name}"]
+ }
+
+ # Cron jobs for notifications and statistics
+ cron {"bugzilla-collectstats-${name}":
+ command => "cd /usr/share/bugzilla; ./collectstats.pl",
+ user => "nobody",
+ hour => 0,
+ minute => 5,
+ environment => $envexport,
+ require => File[$localconfigfile]
+ }
+ cron {"bugzilla-whineatnews-${name}":
+ command => "cd /usr/share/bugzilla; ./whineatnews.pl",
+ user => "nobody",
+ hour => 0,
+ minute => 55,
+ environment => $envexport,
+ require => File[$localconfigfile]
+ }
+ cron {"bugzilla-whine-${name}":
+ command => "cd /usr/share/bugzilla; ./whine.pl",
+ user => "nobody",
+ minute => "*/15",
+ environment => $envexport,
+ require => File[$localconfigfile]
+ }
+}
6 metadata.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": [],
+ "version": "1.0.0",
+ "types": [],
+ "name": "kbarber-bugzilla"
+}
22 templates/answer.erb
@@ -0,0 +1,22 @@
+%answer = (
+ "create_htaccess" => <%= create_htaccess ? 1 : 0 %>,
+ "webservergroup" => '<%= webservergroup %>',
+ "db_driver" => '<%= db_driver %>',
+ "db_host" => '<%= db_host %>',
+ "db_name" => '<%= db_name %>',
+ "db_user" => '<%= db_user %>',
+ "db_pass" => '<%= db_pass %>',
+ "db_port" => <%= db_port %>,
+ "db_sock" => '<%= db_sock %>',
+ "db_check" => <%= db_check ? 1 : 0 %>,
+ "index_html" => <%= index_html ? 1 : 0 %>,
+ "cvsbin" => '<%= cvsbin %>',
+ "interdiffbin" => '<%= interdiffbin %>',
+ "diffpath" => '<%= diffpath %>',
+ "site_wide_secret" => '<%= site_wide_secret %>',
+ "ADMIN_EMAIL" => '<%= admin_email %>',
+ "ADMIN_PASSWORD" => '<%= admin_password %>',
+ "ADMIN_REALNAME" => '<%= admin_realname %>',
+ "NO_PAUSE" => 1,
+ "SMTP_SERVER" => '<%= smtp_server %>',
+)
1  tests/001_install_bugzilla.pp
@@ -0,0 +1 @@
+include bob_bugzilla
30 tests/010_configure_main_env.pp
@@ -0,0 +1,30 @@
+include bob_bugzilla
+
+# This is how you create a single main environment using the defaults.
+bob_bugzilla::project{"main":
+ admin_email => "foo@bob.sh",
+ admin_realname => "Foo Bar",
+ admin_password => "foobar"
+}
+
+# This is a more complex one
+bob_bugzilla::project{"complex":
+ admin_email => "foo@bob.sh",
+ admin_realname => "Foo Bar",
+ admin_password => "foobar",
+ create_htaccess => true,
+ webservergroup => 'apache',
+ db_driver => 'mysql',
+ db_host => 'localhost',
+ db_name => 'bugzilla',
+ db_user => 'bugzilla',
+ db_pass => '',
+ db_port => false,
+ db_sock => '',
+ db_check => true,
+ index_html => false,
+ cvsbin => '/usr/bin/cvs',
+ interdiffbin => '/usr/bin/interdiff',
+ diffpath => '/usr/bin',
+ site_wide_secret => 'krif9f9rkr9f9fker9e44i',
+}
Please sign in to comment.
Something went wrong with that request. Please try again.