lpapicache: force lp access on login to workaround possibly invalid cached creds

This commit is contained in:
Dan Streetman 2022-08-09 12:08:50 -04:00
parent 9c1561ff26
commit 562e6b13cd

View File

@ -76,6 +76,12 @@ class _Launchpad(object):
if not self.logged_in:
self.__lp = LP.login_with('ubuntu-dev-tools', service,
version=api_version)
# Unfortunately launchpadlib may 'login' using cached
# credentials, without actually verifying if the credentials
# are valid; which can lead to this 'login' not actually
# logging in.
# So, this forces actual LP access here, to force actual login.
self.__lp.me
else:
raise AlreadyLoggedInError('Already logged in to Launchpad.')