From d6f10ea7c23cbe528da162566fab08f55bb38e51 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Nov 23 2016 11:08:11 +0000 Subject: [PATCH 1/2] Allow callMethod calls to specify that no retries should be attempted Signed-off-by: Patrick Uiterwijk --- diff --git a/koji/__init__.py b/koji/__init__.py index 4723844..5357f81 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2211,7 +2211,11 @@ class ClientSession(object): def callMethod(self, name, *args, **opts): """compatibility wrapper for _callMethod""" - return self._callMethod(name, args, opts) + retry = True + if 'retry' in opts: + retry = opts['retry'] + del opts['retry'] + return self._callMethod(name, args, opts, retry=retry) def _prepCall(self, name, args, kwargs=None): #pass named opts in a way the server can understand @@ -2309,7 +2313,7 @@ class ClientSession(object): result = result[0] return result - def _callMethod(self, name, args, kwargs=None): + def _callMethod(self, name, args, kwargs=None, retry=True): """Make a call to the hub with retries and other niceties""" if self.multicall: @@ -2364,6 +2368,10 @@ class ClientSession(object): #this behavior is governed by the anon_retry opt. if not self.opts.get('anon_retry', False): raise + + if not retry: + raise + if tries > max_retries: raise #otherwise keep retrying From 3d1a29c8837d6fa23582cb4cc5d2b6f1c6b31844 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Nov 23 2016 11:10:36 +0000 Subject: [PATCH 2/2] Disable automatic request retries for GSSAPI authentication Signed-off-by: Patrick Uiterwijk --- diff --git a/koji/__init__.py b/koji/__init__.py index 5357f81..fb9bec7 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2127,7 +2127,10 @@ class ClientSession(object): self.opts['timeout'] = 60 self.opts['auth'] = HTTPKerberosAuth() try: - sinfo = self.callMethod('sslLogin', proxyuser) + # Depending on the server configuration, we might not be able to + # connect without client certificate, which means that the conn + # will fail with a handshake failure, which is retried by default. + sinfo = self.callMethod('sslLogin', proxyuser, retry=False) finally: self.opts = old_opts if not sinfo: