From 8bdeec0693097f4a352d5993249bfed7cd46ae26 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 19 Sep 2014 15:38:45 -0700 Subject: [PATCH] Switch gerrit to project-config Change-Id: I3e7358b4bc64e494a5990c79d16fafc21f5ed6af --- manifests/site.pp | 2 ++ modules/openstack_project/manifests/gerrit.pp | 15 +++++++++------ modules/openstack_project/manifests/review.pp | 13 ++++++++++--- modules/openstack_project/manifests/review_dev.pp | 14 +++++++++++--- modules/project_config/manifests/init.pp | 7 +++++-- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/manifests/site.pp b/manifests/site.pp index b276f0da24..9d013c7e73 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -52,6 +52,7 @@ node default { # Node-OS: precise node 'review.openstack.org' { class { 'openstack_project::review': + project_config_repo => 'https://git.openstack.org/openstack-infra/project-config', github_oauth_token => hiera('gerrit_github_token', 'XXX'), github_project_username => hiera('github_project_username', 'username'), github_project_password => hiera('github_project_password', 'XXX'), @@ -88,6 +89,7 @@ node 'review.openstack.org' { # Node-OS: precise node 'review-dev.openstack.org' { class { 'openstack_project::review_dev': + project_config_repo => 'https://git.openstack.org/openstack-infra/project-config', github_oauth_token => hiera('gerrit_dev_github_token', 'XXX'), github_project_username => hiera('github_dev_project_username', 'username'), github_project_password => hiera('github_dev_project_password', 'XXX'), diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index e5fb364617..bd7858638a 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -43,6 +43,8 @@ class openstack_project::gerrit ( $contactstore_appsec = '', $contactstore_pubkey = '', $contactstore_url = '', + $acls_dir = 'UNDEF', + $notify_impact_file = 'UNDEF', $projects_file = 'UNDEF', $projects_config = 'UNDEF', $github_username = '', @@ -322,11 +324,12 @@ class openstack_project::gerrit ( require => Class['::gerrit'], } - file { '/home/gerrit2/review_site/hooks/notify_impact.yaml': - ensure => present, - source => - 'puppet:///modules/openstack_project/gerrit/notify_impact.yaml', - require => Class['::gerrit'], + if ($notify_impact_file != 'UNDEF') { + file { '/home/gerrit2/review_site/hooks/notify_impact.yaml': + ensure => present, + source => $notify_impact_file, + require => Class['::gerrit'], + } } file { '/home/gerrit2/review_site/hooks/patchset-created': @@ -407,7 +410,7 @@ class openstack_project::gerrit ( replace => true, purge => true, force => true, - source => 'puppet:///modules/openstack_project/gerrit/acls', + source => $acls_dir, require => Class['::gerrit'] } diff --git a/modules/openstack_project/manifests/review.pp b/modules/openstack_project/manifests/review.pp index 0018329f5c..47c0703d6a 100644 --- a/modules/openstack_project/manifests/review.pp +++ b/modules/openstack_project/manifests/review.pp @@ -78,9 +78,14 @@ class openstack_project::review ( $sysadmins = [], # For openstackwatch. $swift_username = '', - $swift_password = '' + $swift_password = '', + $project_config_repo = '', ) { + class { 'project_config': + url => $project_config_repo, + } + class { 'openstack_project::gerrit': ssl_cert_file => $ssl_cert_file, ssl_key_file => $ssl_key_file, @@ -114,8 +119,9 @@ class openstack_project::review ( contactstore_pubkey => $contactstore_pubkey, contactstore_url => 'http://direct.openstack.org/verify/member/', - projects_file => - 'puppet:///modules/openstack_project/review.projects.yaml', + acls_dir => $::project_config::gerrit_acls_dir, + notify_impact_file => $::project_config::gerrit_notify_impact_file, + projects_file => $::project_config::gerrit_project_file, projects_config => 'openstack_project/review.projects.ini.erb', github_username => 'openstack-gerrit', @@ -180,6 +186,7 @@ class openstack_project::review ( mirror => true, }, ], + require => $::project_config::config_dir, } gerrit::plugin { 'javamelody': diff --git a/modules/openstack_project/manifests/review_dev.pp b/modules/openstack_project/manifests/review_dev.pp index 99fad91b96..a45df5fa2f 100644 --- a/modules/openstack_project/manifests/review_dev.pp +++ b/modules/openstack_project/manifests/review_dev.pp @@ -21,13 +21,19 @@ class openstack_project::review_dev ( $lp_sync_secret = '', $sysadmins = [], $swift_username = '', - $swift_password = '' + $swift_password = '', + $project_config_repo = '', ) { realize ( User::Virtual::Localuser['zaro'], ) + class { 'project_config': + url => $project_config_repo, + base => 'dev/', + } + class { 'openstack_project::gerrit': vhost_name => 'review-dev.openstack.org', canonicalweburl => 'https://review-dev.openstack.org/', @@ -48,8 +54,9 @@ class openstack_project::review_dev ( contactstore_pubkey => $contactstore_pubkey, contactstore_url => 'https://review-dev.openstack.org/fakestore', - projects_file => - 'puppet:///modules/openstack_project/review-dev.projects.yaml', + acls_dir => $::project_config::gerrit_acls_dir, + notify_impact_file => $::project_config::gerrit_notify_impact_file, + projects_file => $::project_config::gerrit_project_file, projects_config => 'openstack_project/review-dev.projects.ini.erb', github_username => 'openstack-gerrit-dev', @@ -81,6 +88,7 @@ class openstack_project::review_dev ( mirror => true, }, ], + require => $::project_config::config_dir, } gerrit::plugin { 'javamelody': diff --git a/modules/project_config/manifests/init.pp b/modules/project_config/manifests/init.pp index a3cc9fd479..53b922377f 100644 --- a/modules/project_config/manifests/init.pp +++ b/modules/project_config/manifests/init.pp @@ -31,7 +31,10 @@ class project_config( } } + $gerrit_acls_dir = "/etc/project-config/${base}gerrit/acls" + $gerrit_notify_impact_file = "/etc/project-config/${base}gerrit/notify_impact.yaml" + $jeepyb_project_file = "/etc/project-config/${base}gerrit/projects.yaml" $jenkins_job_builder_config_dir = "/etc/project-config/${base}jenkins/jobs" - $jenkins_scripts_dir = "/etc/project-config/${base}jenkins/scripts" - $zuul_layout_dir = "/etc/project-config/${base}zuul" + $jenkins_scripts_dir = "/etc/project-config/${base}jenkins/scripts" + $zuul_layout_dir = "/etc/project-config/${base}zuul" }