From fe35df96056feed55a13c0f9df0f721b7a674974 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 17 Jan 2013 14:46:57 +0000 Subject: [PATCH] Add a fake contactstore CGI. This is useful for testing Gerrit's contactstore features if you don't have a real contact store server set up already. * modules/gerrit/files/fakestore.cgi: An extremely trivial shell script which returns the content Gerrit expects from a successful submission to a contactstore server. Note this does not check the application security key or store any of the post variables--it is simply a black hole for contact updates. * modules/gerrit/manifests/init.pp: If the contactstore feature is enabled in Gerrit, install the fakestore.cgi script so it can be available for testing. * modules/gerrit/templates/gerrit.vhost.erb: If the contactstore feature is enabled, ScriptAlias the /fakestore URL to the fakestore.cgi script. Change-Id: Ifa0f80bab9e8b8e207f0ffd83f01c8a3d904618e Reviewed-on: https://review.openstack.org/19939 Reviewed-by: James E. Blair Reviewed-by: Clark Boylan Approved: Jeremy Stanley Reviewed-by: Jeremy Stanley Tested-by: Jenkins --- modules/gerrit/files/fakestore.cgi | 5 +++++ modules/gerrit/manifests/init.pp | 8 ++++++++ modules/gerrit/templates/gerrit.vhost.erb | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 modules/gerrit/files/fakestore.cgi diff --git a/modules/gerrit/files/fakestore.cgi b/modules/gerrit/files/fakestore.cgi new file mode 100644 index 0000000000..3900f578e8 --- /dev/null +++ b/modules/gerrit/files/fakestore.cgi @@ -0,0 +1,5 @@ +#!/bin/sh + +echo 'Content-Type: text/html + +OK' diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp index ac8109e600..75c626132c 100644 --- a/modules/gerrit/manifests/init.pp +++ b/modules/gerrit/manifests/init.pp @@ -519,5 +519,13 @@ class gerrit( replace => true, require => File['/home/gerrit2/review_site/etc'], } + file { '/home/gerrit2/review_site/lib/fakestore.cgi': + ensure => present, + owner => 'root', + group => 'root', + mode => '0555', + source => 'puppet:///modules/gerrit/fakestore.cgi', + require => File['/home/gerrit2/review_site/lib'], + } } } diff --git a/modules/gerrit/templates/gerrit.vhost.erb b/modules/gerrit/templates/gerrit.vhost.erb index 40ec8b6fd3..459478b257 100644 --- a/modules/gerrit/templates/gerrit.vhost.erb +++ b/modules/gerrit/templates/gerrit.vhost.erb @@ -62,6 +62,10 @@ ScriptAlias /p/ /usr/lib/git-core/git-http-backend/ <% end -%> +<% if scope.lookupvar("gerrit::contactstore") == true -%> + ScriptAlias /fakestore /home/gerrit2/review_site/lib/fakestore.cgi +<% end -%> + Order allow,deny Allow from all