From 35070f6ba236ba17d49b54dfc292ed55adc828dd Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Feb 01 2023 14:01:15 +0000 Subject: minor fixes --- diff --git a/docs/schema.sql b/docs/schema.sql index 6d6a24a..1910fac 100644 --- a/docs/schema.sql +++ b/docs/schema.sql @@ -124,6 +124,8 @@ CREATE TABLE sessions ( master IS NULL OR "exclusive" IS NULL), CONSTRAINT exclusive_expired_sane CHECK ( expired IS FALSE OR "exclusive" IS NULL), + CONSTRAINT no_closed_exclusive CHECK ( + closed IS FALSE OR "exclusive" IS NULL), UNIQUE (user_id,exclusive) ) WITHOUT OIDS; CREATE INDEX sessions_master ON sessions(master); diff --git a/koji/__init__.py b/koji/__init__.py index 966b374..b6875c1 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2745,8 +2745,6 @@ class ClientSession(object): self.new_session() # forget our login session, if any - if not self.logged_in: - return self.setSession(None) # we've had some trouble with this method causing strange problems @@ -2789,7 +2787,7 @@ class ClientSession(object): if self.logged_in and not self.sinfo.get('header-auth'): # old server handler = "%s?%s" % (self.baseurl, six.moves.urllib.parse.urlencode(sinfo)) - elif name in 'sslLogin': + elif name == 'sslLogin': handler = self.baseurl + '/ssllogin' else: handler = self.baseurl @@ -2961,9 +2959,7 @@ class ClientSession(object): # server correctly reporting an outage tries = 0 continue - else: - raise err - + raise err except (SystemExit, KeyboardInterrupt): # (depending on the python version, these may or may not be subclasses of # Exception) diff --git a/koji/auth.py b/koji/auth.py index efcb1b6..3959700 100644 --- a/koji/auth.py +++ b/koji/auth.py @@ -439,8 +439,9 @@ class Session(object): excl_id = query.singleValue(strict=False) if excl_id: if force: - # expire the previous exclusive session and try again - update = UpdateProcessor('sessions', data={'expired': True, 'exclusive': None}, + # close the previous exclusive sessions and try again + update = UpdateProcessor('sessions', + data={'expired': True, 'exclusive': None, 'closed': True}, clauses=['id=%(excl_id)s'], values={'excl_id': excl_id},) update.execute() else: