From aeb4a0483332bed927a5dd4ae4848b4bef84178f Mon Sep 17 00:00:00 2001 From: Randy Barlow Date: Dec 11 2017 17:26:06 +0000 Subject: Update to 3.1.0. Signed-off-by: Randy Barlow --- diff --git a/.gitignore b/.gitignore index 13ab6b2..57706e3 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ bodhi-0.7.14.tar.bz2 /bodhi-2.12.1.tar.gz /bodhi-2.12.2.tar.gz /bodhi-3.0.0.tar.gz +/bodhi-3.1.0.tar.gz diff --git a/0001-Retry-auth-in-the-bindings-upon-captcha-key-errors.patch b/0001-Retry-auth-in-the-bindings-upon-captcha-key-errors.patch deleted file mode 100644 index c61f9e1..0000000 --- a/0001-Retry-auth-in-the-bindings-upon-captcha-key-errors.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 9486df151a2eb6d61a35e9466dbdf6c14a913086 Mon Sep 17 00:00:00 2001 -From: Randy Barlow -Date: Mon, 4 Sep 2017 12:19:36 -0400 -Subject: [PATCH] Retry auth in the bindings upon captcha key errors. - -fixes #1787 - -Signed-off-by: Randy Barlow ---- - bodhi/client/bindings.py | 12 +++++++++++- - bodhi/tests/client/test_bindings.py | 32 ++++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+), 1 deletion(-) - -diff --git a/bodhi/client/bindings.py b/bodhi/client/bindings.py -index 57c4260..0bcd717 100644 ---- a/bodhi/client/bindings.py -+++ b/bodhi/client/bindings.py -@@ -73,13 +73,23 @@ def errorhandled(method): - def wrapper(*args, **kwargs): - try: - result = method(*args, **kwargs) -+ # Bodhi allows comments to be written by unauthenticated users if they solve a Captcha. -+ # Due to this, an authentication error is not raised by the server if the client fails -+ # to authenticate for any reason, and instead an error about needing a captcha key is -+ # presented instead. If we see that error, we can just raise an AuthError to trigger the -+ # retry logic in the exception handler below. -+ if 'errors' in result: -+ for error in result['errors']: -+ if 'name' in error and error['name'] == 'captcha_key': -+ raise AuthError('Captcha key needed.') - except AuthError: -- # An AuthError can be raised for three different reasons: -+ # An AuthError can be raised for four different reasons: - # - # 0) The password is wrong. - # 1) The session cookies are expired. fedora.python does not handle this automatically. - # 2) The session cookies are not expired, but are no longer valid (for example, this can - # happen if the server's auth secret has changed.) -+ # 3) The client received a captcha_key error, as described in the try block above. - # - # We don't know the difference between the cases here, but case #1 is fairly common and - # we can work around it and case #2 by removing the session cookies and csrf token and -diff --git a/bodhi/tests/client/test_bindings.py b/bodhi/tests/client/test_bindings.py -index 15c239a..974ecde 100644 ---- a/bodhi/tests/client/test_bindings.py -+++ b/bodhi/tests/client/test_bindings.py -@@ -1001,6 +1001,38 @@ class TestErrorhandled(unittest.TestCase): - self.assertTrue(a_fake_self.csrf_token is None) - self.assertEqual(a_fake_self.call_count, 2) - -+ def test_retry_on_captcha_key_failure(self): -+ """ -+ Test the decorator when the wrapped method returns a captch_key error. -+ -+ This test ensures that the decorator will retry the wrapped method if it returns a -+ captcha_key error, after clearing cookies and the csrf token. -+ -+ This test was written to assert the fix for -+ https://github.com/fedora-infra/bodhi/issues/1787 -+ """ -+ a_fake_self = mock.MagicMock() -+ a_fake_self.csrf_token = 'some_token' -+ a_fake_self.call_count = 0 -+ -+ @bindings.errorhandled -+ def captcha_plz(a_fake_self): -+ a_fake_self.call_count = a_fake_self.call_count + 1 -+ -+ # Fail on the first call with a captcha_key error to simulate unauth'd user on a -+ # comment. -+ if a_fake_self.call_count == 1: -+ return {'errors': [{'name': 'captcha_key'}]} -+ -+ return 'here you go' -+ -+ # No Exception should be raised. -+ captcha_plz(a_fake_self) -+ -+ a_fake_self._session.cookies.clear.assert_called_once_with() -+ self.assertTrue(a_fake_self.csrf_token is None) -+ self.assertEqual(a_fake_self.call_count, 2) -+ - def test_success(self): - """ - Test the decorator for the success case. --- -2.9.5 - diff --git a/bodhi.spec b/bodhi.spec index 208bf33..22c5f6e 100644 --- a/bodhi.spec +++ b/bodhi.spec @@ -1,5 +1,5 @@ Name: bodhi -Version: 3.0.0 +Version: 3.1.0 Release: 1%{?dist} BuildArch: noarch @@ -8,7 +8,6 @@ Summary: A modular framework that facilitates publishing software updates Group: Applications/Internet URL: https://github.com/fedora-infra/bodhi Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz -Patch1: 0001-Retry-auth-in-the-bindings-upon-captcha-key-errors.patch BuildRequires: createrepo_c BuildRequires: fedmsg @@ -25,6 +24,7 @@ BuildRequires: python2-cryptography BuildRequires: python2-devel BuildRequires: python2-dnf BuildRequires: python2-fedora +BuildRequires: python2-feedgen BuildRequires: python2-flake8 BuildRequires: python2-iniparse BuildRequires: python2-jinja2 @@ -38,31 +38,27 @@ BuildRequires: python2-pytest-cov BuildRequires: python2-sphinx BuildRequires: python2-sqlalchemy_schemadisplay BuildRequires: python2-virtualenv -BuildRequires: python2-waitress +BuildRequires: python2-yaml %if 0%{?fedora} >= 28 BuildRequires: python2-alembic BuildRequires: python2-bugzilla -BuildRequires: python2-bunch BuildRequires: python2-openid BuildRequires: python2-pydns BuildRequires: python2-pylibravatar BuildRequires: python2-pyramid-fas-openid BuildRequires: python2-simplemediawiki BuildRequires: python2-urlgrabber -BuildRequires: python2-webhelpers BuildRequires: python2-webtest %else BuildRequires: python-alembic BuildRequires: python-bugzilla -BuildRequires: python-bunch BuildRequires: python-openid BuildRequires: python-pydns BuildRequires: python-pylibravatar BuildRequires: python-pyramid-fas-openid BuildRequires: python-simplemediawiki BuildRequires: python-urlgrabber -BuildRequires: python-webhelpers BuildRequires: python-webtest %endif @@ -171,6 +167,7 @@ Requires: python2-cornice < 2 Requires: python2-createrepo_c Requires: python2-cryptography Requires: python2-fedora +Requires: python2-feedgen Requires: python2-jinja2 Requires: python2-librepo Requires: python2-markdown @@ -179,8 +176,8 @@ Requires: python2-psycopg2 Requires: python2-waitress %if 0%{?fedora} >= 28 +Requires: python2-alembic Requires: python2-bugzilla -Requires: python2-bunch Requires: python2-libxml2 Requires: python2-openid Requires: python2-pydns @@ -188,18 +185,16 @@ Requires: python2-pylibravatar Requires: python2-pyramid-fas-openid Requires: python2-simplemediawiki Requires: python2-urlgrabber -Requires: python2-webhelpers %else Requires: libxml2-python +Requires: python-alembic Requires: python-bugzilla -Requires: python-bunch Requires: python-openid Requires: python-pydns Requires: python-pylibravatar Requires: python-pyramid-fas-openid Requires: python-simplemediawiki Requires: python-urlgrabber -Requires: python-webhelpers %endif %if 0%{?fedora} >= 27 @@ -261,17 +256,13 @@ updates for a software distribution. # Kill some dev deps sed -i '/pyramid_debugtoolbar/d' setup.py -sed -i '/pyramid_debugtoolbar/d' development.ini.example +sed -i '/pyramid_debugtoolbar/d' devel/development.ini.example # Kill this from the egg-info deps so that bodhi-server doesn't demand it. sed -i '/click/d' setup.py -# Configure the alembic.ini config file to point to the location where we've installed the -# migrations. -sed -i 's:script_location = alembic:script_location = %{_datadir}/%{name}/alembic:' alembic.ini - # The unit tests needs a development.ini -mv development.ini.example development.ini +mv devel/development.ini.example development.ini %build @@ -297,7 +288,6 @@ make %{?_smp_mflags} -C docs man %{__install} -m 644 apache/%{name}.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf %{__install} -m 640 production.ini %{buildroot}%{_sysconfdir}/%{name}/production.ini %{__install} -m 640 alembic.ini %{buildroot}%{_sysconfdir}/%{name}/alembic.ini -cp -rf alembic/ %{buildroot}%{_datadir}/%{name}/alembic %{__install} apache/%{name}.wsgi %{buildroot}%{_datadir}/%{name}/%{name}.wsgi %{__install} -m 644 fedmsg.d/masher.py %{buildroot}%{_sysconfdir}/fedmsg.d/masher.py @@ -375,6 +365,7 @@ virtualenv --system-site-packages --no-pip --never-download .test-virtualenv %{python2_sitelib}/%{name}_server-%{version}-py%{python2_version}.egg-info %{_mandir}/man1/bodhi-approve-testing.1* %{_mandir}/man1/bodhi-check-policies.1* +%{_mandir}/man1/bodhi-clean-old-mashes.1* %{_mandir}/man1/bodhi-push.1* %{_mandir}/man1/initialize_bodhi_db.1* %attr(-,bodhi,root) %{_datadir}/%{name} @@ -384,6 +375,11 @@ virtualenv --system-site-packages --no-pip --never-download .test-virtualenv %changelog +* Tue Oct 31 2017 Randy Barlow - 3.1.0-1 +- Update to 3.1.0. +- https://github.com/fedora-infra/bodhi/releases/tag/3.1.0 +- Require alembic in the server package (#1493678). + * Tue Oct 24 2017 Randy Barlow - 3.0.0-1 - Update to 3.0.0 (#1506021). - https://github.com/fedora-infra/bodhi/releases/tag/3.0.0 diff --git a/sources b/sources index 0fc9905..9a932d4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bodhi-3.0.0.tar.gz) = 2a93a9a4e77007cb478217407c811d82e5bea136b10c88c876bdcf01a7731068424f20c6402380136c5f7f796e3bf5c033c57afd32b2d841c308ba32ed488513 +SHA512 (bodhi-3.1.0.tar.gz) = a68e97ad424db8ab739badb91719b83af8ca5c87b468ddde79041f8b81f96bf659503b5604d5a02a112bd681d45e5d577d76536ba4ebc85000e57c684f8c0f0e