From 4774c021532c4629016442473c50a8679f59c573 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 23 Jul 2012 09:43:24 -0500 Subject: [PATCH] Split gerrit remote fetcher into a module. Change-Id: I85fd220da7105363471a1e67fec86cd25dac95c1 --- modules/gerrit/manifests/init.pp | 17 ----------------- modules/gerrit/manifests/remotes.pp | 18 ++++++++++++++++++ modules/openstack_project/manifests/gerrit.pp | 2 -- modules/openstack_project/manifests/review.pp | 10 ++++++---- 4 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 modules/gerrit/manifests/remotes.pp diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp index 8fab2cf3ab..83f0fe0a29 100644 --- a/modules/gerrit/manifests/init.pp +++ b/modules/gerrit/manifests/init.pp @@ -69,7 +69,6 @@ class gerrit($virtual_hostname='', $httpd_maxthreads='', $httpd_maxwait='', $github_projects = [], - $upstream_projects = [], $commentlinks = [ { name => 'changeid', match => '(I[0-9a-f]{8,40})', link => '#q,$1,n,z' }, @@ -179,12 +178,6 @@ class gerrit($virtual_hostname='', environment => "PATH=/usr/bin:/bin:/usr/sbin:/sbin", } - cron { "gerritfetchremotes": - user => gerrit2, - minute => "*/30", - command => 'sleep $((RANDOM\%60+90)) && python /usr/local/gerrit/scripts/fetch_remotes.py', - require => File['/usr/local/gerrit/scripts'], - } } # testmode==false @@ -237,16 +230,6 @@ class gerrit($virtual_hostname='', require => User["gerrit2"] } - file { '/home/gerrit2/remotes.config': - owner => 'root', - group => 'root', - mode => 444, - ensure => 'present', - content => template('gerrit/remotes.config.erb'), - replace => 'true', - require => User["gerrit2"] - } - file { '/home/gerrit2/review_site/static/title.png': ensure => 'present', source => "puppet:///modules/gerrit/${logo}", diff --git a/modules/gerrit/manifests/remotes.pp b/modules/gerrit/manifests/remotes.pp new file mode 100644 index 0000000000..da27242b10 --- /dev/null +++ b/modules/gerrit/manifests/remotes.pp @@ -0,0 +1,18 @@ +class gerrit::remotes($upstream_projects) { + cron { "gerritfetchremotes": + user => gerrit2, + minute => "*/30", + command => 'sleep $((RANDOM\%60+90)) && python /usr/local/gerrit/scripts/fetch_remotes.py', + require => File['/usr/local/gerrit/scripts'], + } + + file { '/home/gerrit2/remotes.config': + owner => 'root', + group => 'root', + mode => 444, + ensure => 'present', + content => template('gerrit/remotes.config.erb'), + replace => 'true', + require => User["gerrit2"] + } +} diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index 15616bbf35..546b199607 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -14,7 +14,6 @@ class openstack_project::gerrit ( $httpd_maxthreads='', $httpd_maxwait='', $github_projects = [], - $upstream_projects = [], $war, $script_user, $script_key_file, @@ -51,7 +50,6 @@ class openstack_project::gerrit ( httpd_maxthreads => $httpd_maxthreads, httpd_maxwait => $httpd_maxwait, github_projects => $github_projects, - upstream_projects => $upstream_projects, war => $war, script_user => $script_user, script_key_file => $script_key_file, diff --git a/modules/openstack_project/manifests/review.pp b/modules/openstack_project/manifests/review.pp index 325cfe3c69..310ebb075e 100644 --- a/modules/openstack_project/manifests/review.pp +++ b/modules/openstack_project/manifests/review.pp @@ -38,10 +38,6 @@ class openstack_project::review { sshd_threads => '100', httpd_maxwait => '5000min', github_projects => $openstack_project::project_list, - upstream_projects => [ { - name => 'openstack-ci/gerrit', - remote => 'https://gerrit.googlesource.com/gerrit' - } ], war => 'http://tarballs.openstack.org/ci/gerrit-2.4.1-10-g63110fd.war', script_user => 'launchpadsync', script_key_file => '/home/gerrit2/.ssh/launchpadsync_rsa', @@ -56,4 +52,10 @@ class openstack_project::review { gerritbot_server => 'irc.freenode.net', gerritbot_user => 'gerritbot' } + class { 'gerrit::remotes': + upstream_projects => [ { + name => 'openstack-ci/gerrit', + remote => 'https://gerrit.googlesource.com/gerrit' + } ], + } }