From 22b92fc984a1651caa7c833f7b798d9ec98f0298 Mon Sep 17 00:00:00 2001
From: Joshua Hesketh <josh@nitrotech.org>
Date: Tue, 7 Oct 2014 18:27:43 +1100
Subject: [PATCH] Reload the gerrit header with its dependencies

When gerrit loads a header it adds the md5sum of the resources
linked from within the header to the uri (eg
static/hideci.js?e=1231d06b0e69a2dc7cf953b47f3b9d853b9). This is
then evaluated when the static content is requested from the gerrit-
server. As such when the md5 of one of the resources changes we need
to reload the header for new sums to be calculated.

Change-Id: I330f123d3eff6109539d9f06f80c8212a33781e1
---
 modules/openstack_project/manifests/gerrit.pp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp
index bd7858638a..f7f98fa99d 100644
--- a/modules/openstack_project/manifests/gerrit.pp
+++ b/modules/openstack_project/manifests/gerrit.pp
@@ -258,6 +258,7 @@ class openstack_project::gerrit (
     ensure  => present,
     source  => 'puppet:///modules/openstack_project/openstack.png',
     require => Class['::gerrit'],
+    notify => Exec['reload_gerrit_header'],
   }
 
   file { '/home/gerrit2/review_site/static/openstack-page-bkg.jpg':
@@ -275,12 +276,14 @@ class openstack_project::gerrit (
     source  => '/usr/share/javascript/jquery/jquery.min.js',
     require => [Class['::gerrit'],
                 Package['libjs-jquery']],
+    notify => Exec['reload_gerrit_header'],
   }
 
   file { '/home/gerrit2/review_site/static/hideci.js':
     ensure  => present,
     source  => 'puppet:///modules/openstack_project/gerrit/hideci.js',
     require => Class['::gerrit'],
+    notify => Exec['reload_gerrit_header'],
   }
 
   file { '/home/gerrit2/review_site/etc/GerritSite.css':
@@ -296,6 +299,12 @@ class openstack_project::gerrit (
     require => Class['::gerrit'],
   }
 
+  exec { 'reload_gerrit_header':
+    command     => 'touch /home/gerrit2/review_site/etc/GerritSiteHeader.html',
+    path        => 'bin:/usr/bin',
+    refreshonly => true,
+  }
+
   cron { 'gerritsyncusers':
     ensure => absent,
   }