Alex Monk has uploaded a new change for review.

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

Change subject: deployment-prep: Point upload cache at swift, fix rewrite.py to 
use beta.wmflabs.org domains
......................................................................

deployment-prep: Point upload cache at swift, fix rewrite.py to use 
beta.wmflabs.org domains

Bug: T64835
Change-Id: Ie0ed6ddeeeb0f12ce4b4dc271db0528add894296
---
M hieradata/labs.yaml
M modules/swift/files/SwiftMedia/wmf/rewrite.py
2 files changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/97/298297/1

diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml
index 4caaf7b..9792dcb 100644
--- a/hieradata/labs.yaml
+++ b/hieradata/labs.yaml
@@ -93,13 +93,11 @@
   swift:
     route: eqiad
     backends:
-      # ms emulator set in July 2013. Beta does not have Swift yet.
-      # instance is an unpuppetized hack with nginx proxy.
-      eqiad: '10.68.16.189' # deployment-upload.eqiad.wmflabs
+      eqiad: '10.68.16.96' # deployment-ms-fe01.deployment-prep.eqiad.wmflabs
   swift_thumbs:
     route: eqiad
     backends:
-      eqiad: '10.68.16.189' # deployment-upload.eqiad.wmflabs
+      eqiad: '10.68.16.96' # deployment-ms-fe01.deployment-prep.eqiad.wmflabs
 role::cache::base::zero_site: 'http://zero.wikimedia.beta.wmflabs.org'
 role::cache::base::purge_host_only_upload_re: '^upload\.beta\.wmflabs\.org$'
 role::cache::base::purge_host_not_upload_re: '^(?!upload\.beta\.wmflabs\.org)'
diff --git a/modules/swift/files/SwiftMedia/wmf/rewrite.py 
b/modules/swift/files/SwiftMedia/wmf/rewrite.py
index 9673b0e..9298a06 100644
--- a/modules/swift/files/SwiftMedia/wmf/rewrite.py
+++ b/modules/swift/files/SwiftMedia/wmf/rewrite.py
@@ -11,6 +11,7 @@
 import urlparse
 from swift.common.utils import get_logger
 from swift.common.wsgi import WSGIContext
+import os
 
 
 class DumbRedirectHandler(urllib2.HTTPRedirectHandler):
@@ -42,6 +43,12 @@
         # as is (eg. upload/proj/lang/) or with the site/lang converted  and
         # only the path sent back (eg en.wikipedia/thumb).
         self.backend_url_format = conf['backend_url_format'].strip()  # asis, 
sitelang
+
+        exists = os.path.isfile('/etc/wmflabs-project')
+        if exists and open('/etc/wmflabs-project').read() == 
'deployment-prep\n':
+            self.tld = 'beta.wmflabs.org'
+        else:
+            self.tld = 'org'
 
     def handle404(self, reqorig, url, container, obj):
         """
@@ -95,10 +102,10 @@
                         if(lang in ['mediawiki']):
                             lang = 'www'
                             proj = 'mediawiki'
-                    hostname = '%s.%s.org' % (lang, proj)
+                    hostname = '%s.%s.%s' % (lang, proj, self.tld)
                     if(proj == 'wikipedia' and lang == 'sources'):
                         # yay special case
-                        hostname = 'wikisource.org'
+                        hostname = 'wikisource.%s' % self.tld
                     # ok, replace the URL with just the part starting with 
thumb/
                     # take off the first two parts of the path
                     # (eg /wikipedia/commons/); make sure the string starts

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

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

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

Reply via email to