BBlack has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/257917

Change subject: text VCL: move layer-common vcl_hash to text-common
......................................................................

text VCL: move layer-common vcl_hash to text-common

Change-Id: If69ef96902810eef63282e51fdfd93a2aa7b2fc6
---
M templates/varnish/text-backend.inc.vcl.erb
M templates/varnish/text-common.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
3 files changed, 29 insertions(+), 58 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/17/257917/1

diff --git a/templates/varnish/text-backend.inc.vcl.erb 
b/templates/varnish/text-backend.inc.vcl.erb
index 9affd43..8a9fc55 100644
--- a/templates/varnish/text-backend.inc.vcl.erb
+++ b/templates/varnish/text-backend.inc.vcl.erb
@@ -122,32 +122,3 @@
        call errorpage;
        return (deliver);
 }
-
-sub vcl_hash {
-       // The cookies below represent mobile preferences that can be set for 
anonymous users.
-       if (req.http.X-Subdomain) {
-<% if scope.function_hiera(["cluster"]) == "cache_text" -%>
-               // this splits the cache between mobile and desktop variants in 
general
-               // the text-cluster conditional is temporary, to avoid 
effectively wiping the primary cache
-               // on the legacy mobile cluster on deploy
-               hash_data("Mobile-Subdomain");
-<% end -%>
-
-               // Split the cache for the images-disabled variant of the 
mobile site.
-               if (req.http.X-Orig-Cookie ~ "(^|;\s*)disableImages=1" || 
req.http.Cookie ~ "(^|;\s*)disableImages=1") {
-                       hash_data("disableImages=1");
-               }
-
-               // Split the cache if the NetSpeed cookie is set and if its 
value is 'B'. The only other
-               // permissable value is 'A', which is equivalent to not having 
the cookie at all, so we
-               // don't need to update the hash in that case.
-               if (req.http.X-Orig-Cookie ~ "(^|;\s*)NetSpeed=B" || 
req.http.Cookie ~ "(^|;\s*)NetSpeed=B") {
-                       hash_data("NetSpeed=B");
-               }
-
-               // Split the cache for the beta variant of the mobile site.
-               if (req.http.X-Orig-Cookie ~ "(^|;\s*)optin=beta" || 
req.http.Cookie ~ "(^|;\s*)optin=beta") {
-                       hash_data("optin=beta");
-               }
-       }
-}
diff --git a/templates/varnish/text-common.inc.vcl.erb 
b/templates/varnish/text-common.inc.vcl.erb
index 0f3f35d..c8ba112 100644
--- a/templates/varnish/text-common.inc.vcl.erb
+++ b/templates/varnish/text-common.inc.vcl.erb
@@ -55,3 +55,32 @@
                return (pass);
        }
 }
+
+sub vcl_hash {
+       // The cookies below represent mobile preferences that can be set for 
anonymous users.
+       if (req.http.X-Subdomain) {
+<% if scope.function_hiera(["cluster"]) == "cache_text" -%>
+               // this splits the cache between mobile and desktop variants in 
general
+               // the text-cluster conditional is temporary, to avoid 
effectively wiping the primary cache
+               // on the legacy mobile cluster on deploy
+               hash_data("Mobile-Subdomain");
+<% end -%>
+
+               // Split the cache for the images-disabled variant of the 
mobile site.
+               if (req.http.X-Orig-Cookie ~ "(^|;\s*)disableImages=1" || 
req.http.Cookie ~ "(^|;\s*)disableImages=1") {
+                       hash_data("disableImages=1");
+               }
+
+               // Split the cache if the NetSpeed cookie is set and if its 
value is 'B'. The only other
+               // permissable value is 'A', which is equivalent to not having 
the cookie at all, so we
+               // don't need to update the hash in that case.
+               if (req.http.X-Orig-Cookie ~ "(^|;\s*)NetSpeed=B" || 
req.http.Cookie ~ "(^|;\s*)NetSpeed=B") {
+                       hash_data("NetSpeed=B");
+               }
+
+               // Split the cache for the beta variant of the mobile site.
+               if (req.http.X-Orig-Cookie ~ "(^|;\s*)optin=beta" || 
req.http.Cookie ~ "(^|;\s*)optin=beta") {
+                       hash_data("optin=beta");
+               }
+       }
+}
diff --git a/templates/varnish/text-frontend.inc.vcl.erb 
b/templates/varnish/text-frontend.inc.vcl.erb
index ed1e398..fddf1fb 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -205,32 +205,3 @@
        }
 <% end -%>
 }
-
-sub vcl_hash {
-       // The cookies below represent mobile preferences that can be set for 
anonymous users.
-       if (req.http.X-Subdomain) {
-<% if scope.function_hiera(["cluster"]) == "cache_text" -%>
-               // this splits the cache between mobile and desktop variants in 
general
-               // the text-cluster conditional is temporary, to avoid 
effectively wiping the primary cache
-               // on the legacy mobile cluster on deploy
-               hash_data("Mobile-Subdomain");
-<% end -%>
-
-               // Split the cache for the images-disabled variant of the 
mobile site.
-               if (req.http.X-Orig-Cookie ~ "(^|;\s*)disableImages=1" || 
req.http.Cookie ~ "(^|;\s*)disableImages=1") {
-                       hash_data("disableImages=1");
-               }
-
-               // Split the cache if the NetSpeed cookie is set and if its 
value is 'B'. The only other
-               // permissable value is 'A', which is equivalent to not having 
the cookie at all, so we
-               // don't need to update the hash in that case.
-               if (req.http.X-Orig-Cookie ~ "(^|;\s*)NetSpeed=B" || 
req.http.Cookie ~ "(^|;\s*)NetSpeed=B") {
-                       hash_data("NetSpeed=B");
-               }
-
-               // Split the cache for the beta variant of the mobile site.
-               if (req.http.X-Orig-Cookie ~ "(^|;\s*)optin=beta" || 
req.http.Cookie ~ "(^|;\s*)optin=beta") {
-                       hash_data("optin=beta");
-               }
-       }
-}

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

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

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

Reply via email to