Repository: fedora-infra/bodhi

Issue:
Drop bodhi.server.services.zz_redirects
This module exists to redirect legacy Bodhi 1 URLs to the Bodhi 2 counterparts, but I don't think we need it anymore. Bodhi 2 is not backwards compatible with Bodhi 1, and Bodhi 4 will also be further incompatible.


Discussion:

Resolving patch:
diff --git a/bodhi/server/services/zz_redirects.py b/bodhi/server/services/zz_redirects.py
deleted file mode 100644
--- a/bodhi/server/services/zz_redirects.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright © 2015-2017 Red Hat, Inc.
-#
-# This file is part of Bodhi.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-"""
-Handle general redirect stuff.
-
-This module name gets a 'zz_' tacked on the front so that it comes last.
-We need to catch /updates/{id}/request and /updates/{id}/edit first and those
-get defined in the other service modules.
-"""
-
-from cornice import Service
-from pyramid.httpexceptions import HTTPFound
-
-import bodhi.server.security
-
-
-zz_bodhi1_update_redirect = Service(
-    name='bodhi1_update_redirect', path='/updates/{id}/{title}',
-    description='Redirect to old updates/ALIAS/TITLE urls',
-    cors_origins=bodhi.server.security.cors_origins_rw)
-
-
-@zz_bodhi1_update_redirect.get()
-def zz_get_bodhi1_update_redirect(request):
-    """
-    Redirect users from the Bodhi 1 update URL to the new path.
-
-    Args:
-        request (pyramid.request): The current web request.
-    Returns:
-        pyramid.httpexceptions.HTTPFound: A redirect to the same update in Bodhi's current URL
-            heirarchy.
-    """
-    return HTTPFound("/updates/{0}".format(request.matchdict['id']))


Test patch:
diff --git a/bodhi/tests/server/services/test_updates.py b/bodhi/tests/server/services/test_updates.py
--- a/bodhi/tests/server/services/test_updates.py
+++ b/bodhi/tests/server/services/test_updates.py
@@ -1545,26 +1545,6 @@ def test_provenpackager_request_update_with_none_test_gating(self, publish, *arg
             res.json_body['errors'][0]['description'],
             config.get('not_yet_tested_msg'))
 
-    @mock.patch(**mock_valid_requirements)
-    @mock.patch('bodhi.server.notifications.publish')
-    def test_old_bodhi1_redirect(self, publish, *args):
-        # Create it
-        title = 'bodhi-2.0.0-1.fc17'
-        self.app.post_json('/updates/', self.get_update(title))
-        publish.assert_called_once_with(
-            topic='update.request.testing', msg=mock.ANY)
-
-        # Get it once with just the title
-        url = '/updates/%s' % title
-        res = self.app.get(url)
-        update = res.json_body['update']
-
-        # Now try the old bodhi1 url.  Redirect should take place.
-        url = '/updates/%s/%s' % (update['alias'], update['title'])
-        res = self.app.get(url, status=302)
-        target = 'http://localhost/updates/%s' % update['alias']
-        self.assertEqual(res.headers['Location'], target)
-
     def test_404(self):
         self.app.get('/a', status=404)