From a7a9c8b38fedf8582fa0d31bbcb652edbde9d427 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 23 Jan 2020 13:52:15 -0800 Subject: [PATCH] Change default Gerrit HTTP auth method The current default HTTP authentication method for Zuul's Gerrit driver is Digest, but that has not been supported by Gerrit since version 2.15. Change the default to Basic which matches the current default and should be the value for most Gerrit installations. Change-Id: I4b034311dba53d959b4e1dfd2e9319ade45b1438 --- doc/source/reference/drivers/gerrit.rst | 15 ++++++++------- .../gerrit-default-auth-c6165622bffc6434.yaml | 8 ++++++++ zuul/driver/gerrit/gerritconnection.py | 6 +++--- 3 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/gerrit-default-auth-c6165622bffc6434.yaml diff --git a/doc/source/reference/drivers/gerrit.rst b/doc/source/reference/drivers/gerrit.rst index 61b45877e9..cc924eb4d6 100644 --- a/doc/source/reference/drivers/gerrit.rst +++ b/doc/source/reference/drivers/gerrit.rst @@ -103,18 +103,19 @@ The supported options in ``zuul.conf`` connections are: section of the ``Settings`` page in Gerrit. .. attr:: auth_type - :default: digest + :default: basic The HTTP authentication mechanism. - .. value:: digest - - HTTP Digest authentication; the default for most Gerrit - installations. - .. value:: basic - HTTP Basic authentication. + HTTP Basic authentication; the default for most Gerrit + installations. + + .. value:: digest + + HTTP Digest authentication; only used in versions of Gerrit + prior to 2.15. .. value:: form diff --git a/releasenotes/notes/gerrit-default-auth-c6165622bffc6434.yaml b/releasenotes/notes/gerrit-default-auth-c6165622bffc6434.yaml new file mode 100644 index 0000000000..19a358989a --- /dev/null +++ b/releasenotes/notes/gerrit-default-auth-c6165622bffc6434.yaml @@ -0,0 +1,8 @@ +upgrade: + - | + The default for :attr:`.auth_type` has changed from + ``digest`` to ``basic``. Digest authentication has not been supported + in Gerrit since version 2.15. + + If your Zuul connects to an older version of Gerrit via HTTP + authentication, you may now need to explicitly set this value. diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py index 8b9299db46..7dea617ea8 100644 --- a/zuul/driver/gerrit/gerritconnection.py +++ b/zuul/driver/gerrit/gerritconnection.py @@ -483,12 +483,12 @@ class GerritConnection(BaseConnection): zuul_version.release_string, requests.utils.default_user_agent()) self.session = requests.Session() - if self.auth_type == 'basic': - authclass = requests.auth.HTTPBasicAuth + if self.auth_type == 'digest': + authclass = requests.auth.HTTPDigestAuth elif self.auth_type == 'form': authclass = FormAuth else: - authclass = requests.auth.HTTPDigestAuth + authclass = requests.auth.HTTPBasicAuth self.auth = authclass( self.user, self.password)