Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350493 )

Change subject: varnish: Convert errorpage into re-usable template
......................................................................

varnish: Convert errorpage into re-usable template

* Move varnish/files/errorpage.html
  to mediawiki/templates/errorpage.html.erb.
* Turn fixed strings into variables.
* Add FIXME about using concat instead of string replace
  to insert the error variable, which makes for an awkward
  template currently. Supported for now by offering an arbitrary
  'append' variable.

Bug: T113114
Change-Id: I6b63bcef8d625c80d7391165237d2797999bf92b
---
R modules/mediawiki/templates/errorpage.html.erb
M modules/varnish/manifests/common/vcl.pp
2 files changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/93/350493/1

diff --git a/modules/varnish/files/errorpage.html 
b/modules/mediawiki/templates/errorpage.html.erb
similarity index 64%
rename from modules/varnish/files/errorpage.html
rename to modules/mediawiki/templates/errorpage.html.erb
index 395fdef..17d6303 100644
--- a/modules/varnish/files/errorpage.html
+++ b/modules/mediawiki/templates/errorpage.html.erb
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang=en>
 <meta charset=utf-8>
-<title>Wikimedia Error</title>
+<title><%= @errorpage['title'] %></title>
 <style>
 * { margin: 0; padding: 0; }
 body { background: #fff; font: 15px/1.6 sans-serif; color: #333; }
@@ -19,8 +19,7 @@
 <div class="content" role="main">
 <a href="https://www.wikimedia.org";><img 
src="https://www.wikimedia.org/static/images/wmf.png"; 
srcset="https://www.wikimedia.org/static/images/wmf-2x.png 2x" alt=Wikimedia 
width=135 height=135></a>
 <h1>Error</h1>
-<p>Our servers are currently under maintenance or experiencing a technical 
problem. Please <a href="" title="Reload this page" 
onclick="window.location.reload(false); return false">try again</a> in a 
few&nbsp;minutes.</p><p>See the error message at the bottom of this page for 
more&nbsp;information.</p>
+<%= @errorpage['content'] %>
 </div>
-<div class="footer">
-<p>If you report this error to the Wikimedia System Administrators, please 
include the details below.</p>
-<p class="text-muted"><code>
+<% if @errorpage['footer'] %><div class="footer"><%= @errorpage['footer'] 
%></div><% end %>
+<% if @errorpage['append'] %><%= @errorpage['append'] %><% end %>
diff --git a/modules/varnish/manifests/common/vcl.pp 
b/modules/varnish/manifests/common/vcl.pp
index 7761eb5..9cda0f0 100644
--- a/modules/varnish/manifests/common/vcl.pp
+++ b/modules/varnish/manifests/common/vcl.pp
@@ -15,11 +15,19 @@
         content => template('varnish/analytics.inc.vcl.erb'),
     }
 
+    $errorpage  = {
+        title       => 'Wikimedia Error',
+        content     => '<p>Our servers are currently under maintenance or 
experiencing a technical problem. Please <a href="" title="Reload this page" 
onclick="window.location.reload(false); return false">try again</a> in a 
few&nbsp;minutes.</p><p>See the error message at the bottom of this page for 
more&nbsp;information.</p>',
+        # Use append instead of footer because we intentionally leave the
+        # "div.footer > p > code" stack unclosed.
+        # We then let errorpage.incl.vcl concatenate and close the stack.
+        append      => '<div class="footer"><p>If you report this error to the 
Wikimedia System Administrators, please include the details below.</p><p 
class="text-muted"><code>',
+    }
     file { '/etc/varnish/errorpage.html':
         owner  => 'root',
         group  => 'root',
         mode   => '0444',
-        source => 'puppet:///modules/varnish/errorpage.html',
+        source => template('mediawiki/errorpage.html.erb'),
     }
 
     # VTC tests

-- 
To view, visit https://gerrit.wikimedia.org/r/350493
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b63bcef8d625c80d7391165237d2797999bf92b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to