← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mwhudson/launchpad/vostok-add-layer into lp:launchpad/devel

 

Michael Hudson has proposed merging lp:~mwhudson/launchpad/vostok-add-layer into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Hi,

This branch is mostly unavoidable and boring stuff to add a new vhost
('vostok') and accompanying layer/skin.

The change to lib/lp/code/xmlrpc/tests/test_codehosting.py is just to remove a
meaningless hit when grepping launchpad for 'vostok'

Cheers,
mwh
-- 
https://code.launchpad.net/~mwhudson/launchpad/vostok-add-layer/+merge/31238
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mwhudson/launchpad/vostok-add-layer into lp:launchpad/devel.
=== modified file 'Makefile'
--- Makefile	2010-06-25 15:03:10 +0000
+++ Makefile	2010-07-29 05:08:46 +0000
@@ -398,11 +398,13 @@
 	# We insert the absolute path to the branch-rewrite script
 	# into the Apache config as we copy the file into position.
 	sed -e 's,%BRANCH_REWRITE%,$(shell pwd)/scripts/branch-rewrite.py,' configs/development/local-launchpad-apache > /etc/apache2/sites-available/local-launchpad
+	cp configs/development/local-vostok-apache /etc/apache2/sites-available/local-vosok
 	touch /var/tmp/bazaar.launchpad.dev/rewrite.log
 	chown $(SUDO_UID):$(SUDO_GID) /var/tmp/bazaar.launchpad.dev/rewrite.log
 
 enable-apache-launchpad: copy-apache-config copy-certificates
 	a2ensite local-launchpad
+	a2ensite local-vostok
 
 reload-apache: enable-apache-launchpad
 	/etc/init.d/apache2 restart

=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf	2010-07-25 05:16:58 +0000
+++ configs/development/launchpad-lazr.conf	2010-07-29 05:08:46 +0000
@@ -330,6 +330,9 @@
 [vhost.feeds]
 hostname: feeds.launchpad.dev
 
+[vhost.vostok]
+hostname: vostok.dev
+
 [zopeless]
 # XXX sinzui 2008-03-26:
 # A development box should never send email to the outer world,

=== added file 'configs/development/local-vostok-apache'
--- configs/development/local-vostok-apache	1970-01-01 00:00:00 +0000
+++ configs/development/local-vostok-apache	2010-07-29 05:08:46 +0000
@@ -0,0 +1,52 @@
+NameVirtualHost 127.0.0.77:80
+
+RewriteLock /var/tmp/vostok-rewrite-lock
+
+<VirtualHost 127.0.0.77:80>
+  ServerName archive.vostok.dev
+  LogLevel debug
+
+  DocumentRoot /var/tmp/vostok-archive
+  <Directory /var/tmp/vostok-archive/>
+    Order Deny,Allow
+    Deny from all
+    Allow from 127.0.0.0/255.0.0.0
+    Options Indexes
+  </Directory>
+</VirtualHost>
+
+<VirtualHost 127.0.0.77:443>
+  ServerName vostok.dev
+  ServerAlias *.vostok.dev
+  <Proxy *>
+    Order deny,allow
+    Allow from 127.0.0.0/255.0.0.0
+  </Proxy>
+  SSLEngine On
+  SSLCertificateFile /etc/apache2/ssl/launchpad.crt
+  SSLCertificateKeyFile /etc/apache2/ssl/launchpad.key
+
+  ProxyPreserveHost on
+  ProxyPass / http://localhost:8086/ retry=1
+
+  <Location />
+    # Insert filter
+    SetOutputFilter DEFLATE
+
+    # Don't compress images
+    SetEnvIfNoCase Request_URI \
+    \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+
+    # Don't gzip anything that starts /@@/ and doesn't end .js (ie images)
+    SetEnvIfNoCase Request_URI ^/@@/ no-gzip dont-vary
+    SetEnvIfNoCase Request_URI ^/@@/.*\.js$ !no-gzip !dont-vary
+  </Location>
+
+</VirtualHost>
+
+<VirtualHost 127.0.0.77:80>
+  ServerName vostok.dev
+  ServerAlias *.vostok.dev
+  RewriteEngine On
+  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
+</VirtualHost>

=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf	2010-07-26 09:23:26 +0000
+++ lib/canonical/config/schema-lazr.conf	2010-07-29 05:08:46 +0000
@@ -2000,6 +2000,8 @@
 
 [vhost.feeds]
 
+[vhost.vostok]
+
 
 [windmill]
 # The location of the windmill server debug logs.  This will be written to

=== modified file 'lib/canonical/launchpad/configure.zcml'
--- lib/canonical/launchpad/configure.zcml	2010-06-04 20:59:50 +0000
+++ lib/canonical/launchpad/configure.zcml	2010-07-29 05:08:46 +0000
@@ -32,6 +32,7 @@
   <include package="lp.testopenid" />
   <include package="lp.blueprints" />
   <include package="lp.services.comments" />
+  <include package="lp.vostok" />
 
   <browser:url
     for="canonical.launchpad.interfaces.IPersonSet"

=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
--- lib/lp/code/xmlrpc/tests/test_codehosting.py	2010-07-28 04:18:53 +0000
+++ lib/lp/code/xmlrpc/tests/test_codehosting.py	2010-07-29 05:08:46 +0000
@@ -206,11 +206,11 @@
         started_tuple = tuple(started.utctimetuple())
         completed_tuple = tuple(completed.utctimetuple())
         success = self.codehosting_api.recordSuccess(
-            'test-recordsuccess', 'vostok', started_tuple, completed_tuple)
+            'test-recordsuccess', 'server-name', started_tuple, completed_tuple)
         self.assertEqual(True, success)
 
         activity = self.getLastActivity('test-recordsuccess')
-        self.assertEqual('vostok', activity.hostname)
+        self.assertEqual('server-name', activity.hostname)
         self.assertEqual(started, activity.date_started)
         self.assertEqual(completed, activity.date_completed)
 

=== added directory 'lib/lp/vostok'
=== added file 'lib/lp/vostok/__init__.py'
--- lib/lp/vostok/__init__.py	1970-01-01 00:00:00 +0000
+++ lib/lp/vostok/__init__.py	2010-07-29 05:08:46 +0000
@@ -0,0 +1,4 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""The Linaro archive management skin."""

=== added file 'lib/lp/vostok/configure.zcml'
--- lib/lp/vostok/configure.zcml	1970-01-01 00:00:00 +0000
+++ lib/lp/vostok/configure.zcml	2010-07-29 05:08:46 +0000
@@ -0,0 +1,14 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope";
+   xmlns:browser="http://namespaces.zope.org/browser";
+   xmlns:i18n="http://namespaces.zope.org/i18n";
+   xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc";
+   i18n_domain="launchpad">
+
+  <publisher
+     name="vostok"
+     factory="lp.vostok.publisher.vostok_request_publication_factory"
+     methods="*"
+     mimetypes="*" />
+
+</configure>

=== added file 'lib/lp/vostok/publisher.py'
--- lib/lp/vostok/publisher.py	1970-01-01 00:00:00 +0000
+++ lib/lp/vostok/publisher.py	2010-07-29 05:08:46 +0000
@@ -0,0 +1,37 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Vostok's custom publication."""
+
+__metaclass__ = type
+__all__ = [
+    'VostokBrowserRequest',
+    'VostokLayer',
+    'vostok_request_publication_factory',
+    ]
+
+
+from zope.interface import implements
+from zope.publisher.interfaces.browser import (
+    IBrowserRequest, IDefaultBrowserLayer)
+
+from canonical.launchpad.webapp.publication import LaunchpadBrowserPublication
+from canonical.launchpad.webapp.servers import (
+    LaunchpadBrowserRequest, VirtualHostRequestPublicationFactory)
+
+
+class VostokLayer(IBrowserRequest, IDefaultBrowserLayer):
+    """The Vostok layer."""
+
+
+class VostokBrowserRequest(LaunchpadBrowserRequest):
+    implements(VostokLayer)
+
+
+# We *might* end up customizing the root object and so need our own
+# LaunchpadBrowserPublication subclass.  Not yet though.
+
+
+def vostok_request_publication_factory():
+    return VirtualHostRequestPublicationFactory(
+        'vostok', VostokBrowserRequest, LaunchpadBrowserPublication)

=== added directory 'lib/lp/vostok/tests'
=== added file 'lib/lp/vostok/tests/__init__.py'
--- lib/lp/vostok/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ lib/lp/vostok/tests/__init__.py	2010-07-29 05:08:46 +0000
@@ -0,0 +1,4 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Tests for the Linaro archive management skin."""

=== added file 'lib/lp/vostok/tests/test_publisher.py'
--- lib/lp/vostok/tests/test_publisher.py	1970-01-01 00:00:00 +0000
+++ lib/lp/vostok/tests/test_publisher.py	2010-07-29 05:08:46 +0000
@@ -0,0 +1,33 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Tests for vostok's custom publications."""
+
+__metaclass__ = type
+
+import unittest
+
+from canonical.config import config
+from canonical.testing.layers import FunctionalLayer
+
+from lp.testing import TestCase
+from lp.testing.publication import get_request_and_publication
+
+from lp.vostok.publisher import VostokLayer
+
+
+class TestRegistration(TestCase):
+    """Vostok's publication customizations are installed correctly."""
+
+    layer = FunctionalLayer
+
+    def test_vostok_request_provides_vostok_layer(self):
+        # The request constructed for requests to the vostok hostname provides
+        # VostokLayer.
+        request, publication = get_request_and_publication(
+            host=config.vhost.vostok.hostname)
+        self.assertProvides(request, VostokLayer)
+
+
+def test_suite():
+    return unittest.TestLoader().loadTestsFromName(__name__)

=== modified file 'utilities/rocketfuel-setup'
--- utilities/rocketfuel-setup	2010-02-12 15:34:28 +0000
+++ utilities/rocketfuel-setup	2010-07-29 05:08:46 +0000
@@ -155,6 +155,14 @@
   echo "bazaar.launchpad.dev added to /etc/hosts"
 fi
 
+grep -q "^127.0.0.77" /etc/hosts
+if [ $? -ne 0 ]; then
+  echo "
+127.0.0.77      vostok.dev archive.vostok.dev
+" | sudo tee -a /etc/hosts > /dev/null
+  echo "vostok.dev added to /etc/hosts"
+fi
+
 # Enable relevant Ubuntu package repositories
 grep -q "^deb http:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list
 if [ $? -ne 0 ]; then