2012-11-21 14:53:55 -05:00
|
|
|
# == Class: github
|
|
|
|
#
|
2012-10-29 11:09:34 -04:00
|
|
|
class github(
|
2012-11-21 14:53:55 -05:00
|
|
|
$username = '',
|
|
|
|
$oauth_token = '',
|
|
|
|
$project_username = '',
|
|
|
|
$project_password = '',
|
2012-10-29 11:09:34 -04:00
|
|
|
$projects = []
|
|
|
|
) {
|
2012-11-22 10:45:10 -08:00
|
|
|
include jeepyb
|
2012-07-23 11:54:48 -05:00
|
|
|
include pip
|
2012-07-23 10:21:29 -05:00
|
|
|
|
2012-11-30 16:56:47 -08:00
|
|
|
if ! defined(Package['PyGithub']) {
|
2012-11-30 15:15:49 -08:00
|
|
|
package { 'PyGithub':
|
|
|
|
ensure => latest, # okay to use latest for pip
|
|
|
|
provider => pip,
|
|
|
|
require => Class['pip'],
|
|
|
|
}
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
2012-10-12 14:48:56 -07:00
|
|
|
# A lot of things need yaml, be conservative requiring this package to avoid
|
|
|
|
# conflicts with other modules.
|
|
|
|
if ! defined(Package['python-yaml']) {
|
|
|
|
package { 'python-yaml':
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-29 11:09:34 -04:00
|
|
|
group { 'github':
|
|
|
|
ensure => present,
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
2012-10-29 11:09:34 -04:00
|
|
|
user { 'github':
|
|
|
|
ensure => present,
|
|
|
|
comment => 'Github API User',
|
|
|
|
shell => '/bin/bash',
|
|
|
|
gid => 'github',
|
|
|
|
require => Group['github'],
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/github':
|
2012-10-29 11:09:34 -04:00
|
|
|
ensure => directory,
|
|
|
|
group => 'root',
|
|
|
|
mode => '0755',
|
|
|
|
owner => 'root',
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/github/github.config':
|
2012-10-29 11:09:34 -04:00
|
|
|
ensure => absent,
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/github/github.secure.config':
|
2012-10-29 11:09:34 -04:00
|
|
|
ensure => present,
|
2012-07-23 20:09:17 -05:00
|
|
|
content => template('github/github.secure.config.erb'),
|
2012-10-29 11:09:34 -04:00
|
|
|
group => 'github',
|
|
|
|
mode => '0440',
|
|
|
|
owner => 'root',
|
|
|
|
replace => true,
|
|
|
|
require => [
|
|
|
|
Group['github'],
|
2012-11-21 14:53:55 -05:00
|
|
|
File['/etc/github'],
|
2012-10-29 11:09:34 -04:00
|
|
|
],
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
2012-11-04 22:20:36 +01:00
|
|
|
file { '/etc/github/github-projects.secure.config':
|
|
|
|
ensure => present,
|
|
|
|
content => template('github/github-projects.secure.config.erb'),
|
|
|
|
group => 'github',
|
|
|
|
mode => '0440',
|
|
|
|
owner => 'root',
|
|
|
|
replace => true,
|
|
|
|
require => [
|
|
|
|
Group['github'],
|
2012-11-21 14:53:55 -05:00
|
|
|
File['/etc/github'],
|
2012-11-04 22:20:36 +01:00
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2012-07-23 10:21:29 -05:00
|
|
|
file { '/usr/local/github':
|
2012-10-29 11:09:34 -04:00
|
|
|
ensure => directory,
|
|
|
|
group => 'root',
|
|
|
|
mode => '0755',
|
|
|
|
owner => 'root',
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/usr/local/github/scripts':
|
2012-11-22 10:45:10 -08:00
|
|
|
ensure => absent,
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
|
2012-10-29 11:09:34 -04:00
|
|
|
cron { 'githubclosepull':
|
2012-11-22 10:45:10 -08:00
|
|
|
command => 'sleep $((RANDOM\%60+90)) && /usr/local/bin/close-pull-requests',
|
2012-10-29 11:09:34 -04:00
|
|
|
minute => '*/5',
|
2012-10-12 14:48:56 -07:00
|
|
|
require => [
|
2012-11-22 10:45:10 -08:00
|
|
|
Class['jeepyb'],
|
2012-10-29 11:09:34 -04:00
|
|
|
Package['python-yaml'],
|
|
|
|
Package['PyGithub'],
|
|
|
|
],
|
|
|
|
user => github,
|
2012-07-23 10:21:29 -05:00
|
|
|
}
|
|
|
|
}
|
2012-10-29 11:09:34 -04:00
|
|
|
|
|
|
|
# vim:sw=2:ts=2:expandtab:textwidth=79
|